More Android L design

This commit is contained in:
DrKLO 2014-11-14 18:40:15 +03:00
parent 5e51393b4b
commit 934408c73f
67 changed files with 2532 additions and 2249 deletions

View File

@ -80,7 +80,7 @@ android {
defaultConfig {
minSdkVersion 8
targetSdkVersion 21
versionCode 380
versionCode 382
versionName "2.0.0"
}
}

View File

@ -824,12 +824,11 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection.
if (invoke.system_version == null || invoke.system_version.length() == 0) {
invoke.system_version = "SDK Unknown";
}
object = invoke;
TLRPC.invokeWithLayer invoke2 = new TLRPC.invokeWithLayer();
invoke2.query = invoke;
FileLog.d("wrap in layer", "" + object);
object = invoke2;
}
TLRPC.invokeWithLayer18 invoke = new TLRPC.invokeWithLayer18();
invoke.query = object;
FileLog.d("wrap in layer", "" + object);
return invoke;
}
return object;
}
@ -1607,12 +1606,12 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection.
TLRPC.TL_protoMessage message = networkMessage.protoMessage;
if (BuildVars.DEBUG_VERSION) {
if (message.body instanceof TLRPC.invokeWithLayer18) {
FileLog.d("tmessages", connection.getSissionId() + ":DC" + datacenter.datacenterId + "> Send message (" + message.seqno + ", " + message.msg_id + "): " + ((TLRPC.invokeWithLayer18)message.body).query);
if (message.body instanceof TLRPC.invokeWithLayer) {
FileLog.d("tmessages", connection.getSissionId() + ":DC" + datacenter.datacenterId + "> Send message (" + message.seqno + ", " + message.msg_id + "): " + ((TLRPC.invokeWithLayer)message.body).query);
} else if (message.body instanceof TLRPC.initConnection) {
TLRPC.initConnection r = (TLRPC.initConnection)message.body;
if (r.query instanceof TLRPC.invokeWithLayer18) {
FileLog.d("tmessages", connection.getSissionId() + ":DC" + datacenter.datacenterId + "> Send message (" + message.seqno + ", " + message.msg_id + "): " + ((TLRPC.invokeWithLayer18)r.query).query);
if (r.query instanceof TLRPC.invokeWithLayer) {
FileLog.d("tmessages", connection.getSissionId() + ":DC" + datacenter.datacenterId + "> Send message (" + message.seqno + ", " + message.msg_id + "): " + ((TLRPC.invokeWithLayer)r.query).query);
} else {
FileLog.d("tmessages", connection.getSissionId() + ":DC" + datacenter.datacenterId + "> Send message (" + message.seqno + ", " + message.msg_id + "): " + r.query);
}
@ -1647,12 +1646,12 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection.
TLRPC.TL_protoMessage message = networkMessage.protoMessage;
containerMessages.add(message);
if (BuildVars.DEBUG_VERSION) {
if (message.body instanceof TLRPC.invokeWithLayer18) {
FileLog.d("tmessages", connection.getSissionId() + ":DC" + datacenter.datacenterId + "> Send message (" + message.seqno + ", " + message.msg_id + "): " + ((TLRPC.invokeWithLayer18)message.body).query);
if (message.body instanceof TLRPC.invokeWithLayer) {
FileLog.d("tmessages", connection.getSissionId() + ":DC" + datacenter.datacenterId + "> Send message (" + message.seqno + ", " + message.msg_id + "): " + ((TLRPC.invokeWithLayer)message.body).query);
} else if (message.body instanceof TLRPC.initConnection) {
TLRPC.initConnection r = (TLRPC.initConnection)message.body;
if (r.query instanceof TLRPC.invokeWithLayer18) {
FileLog.d("tmessages", connection.getSissionId() + ":DC" + datacenter.datacenterId + "> Send message (" + message.seqno + ", " + message.msg_id + "): " + ((TLRPC.invokeWithLayer18)r.query).query);
if (r.query instanceof TLRPC.invokeWithLayer) {
FileLog.d("tmessages", connection.getSissionId() + ":DC" + datacenter.datacenterId + "> Send message (" + message.seqno + ", " + message.msg_id + "): " + ((TLRPC.invokeWithLayer)r.query).query);
} else {
FileLog.d("tmessages", connection.getSissionId() + ":DC" + datacenter.datacenterId + "> Send message (" + message.seqno + ", " + message.msg_id + "): " + r.query);
}

View File

@ -51,6 +51,8 @@ public class TLClassStore {
classStore.put(TLRPC.TL_updates_difference.constructor, TLRPC.TL_updates_difference.class);
classStore.put(TLRPC.TL_geoPointEmpty.constructor, TLRPC.TL_geoPointEmpty.class);
classStore.put(TLRPC.TL_geoPoint.constructor, TLRPC.TL_geoPoint.class);
classStore.put(TLRPC.TL_privacyKeyStatusTimestamp.constructor, TLRPC.TL_privacyKeyStatusTimestamp.class);
classStore.put(TLRPC.TL_account_privacyRules.constructor, TLRPC.TL_account_privacyRules.class);
classStore.put(TLRPC.TL_help_appUpdate.constructor, TLRPC.TL_help_appUpdate.class);
classStore.put(TLRPC.TL_help_noAppUpdate.constructor, TLRPC.TL_help_noAppUpdate.class);
classStore.put(TLRPC.TL_messageForwarded.constructor, TLRPC.TL_messageForwarded.class);
@ -93,8 +95,15 @@ public class TLClassStore {
classStore.put(TLRPC.TL_audioEmpty.constructor, TLRPC.TL_audioEmpty.class);
classStore.put(TLRPC.TL_audio.constructor, TLRPC.TL_audio.class);
classStore.put(TLRPC.TL_destroy_sessions_res.constructor, TLRPC.TL_destroy_sessions_res.class);
classStore.put(TLRPC.TL_privacyValueAllowUsers.constructor, TLRPC.TL_privacyValueAllowUsers.class);
classStore.put(TLRPC.TL_privacyValueDisallowAll.constructor, TLRPC.TL_privacyValueDisallowAll.class);
classStore.put(TLRPC.TL_privacyValueAllowContacts.constructor, TLRPC.TL_privacyValueAllowContacts.class);
classStore.put(TLRPC.TL_privacyValueDisallowContacts.constructor, TLRPC.TL_privacyValueDisallowContacts.class);
classStore.put(TLRPC.TL_privacyValueAllowAll.constructor, TLRPC.TL_privacyValueAllowAll.class);
classStore.put(TLRPC.TL_privacyValueDisallowUsers.constructor, TLRPC.TL_privacyValueDisallowUsers.class);
classStore.put(TLRPC.TL_contacts_contacts.constructor, TLRPC.TL_contacts_contacts.class);
classStore.put(TLRPC.TL_contacts_contactsNotModified.constructor, TLRPC.TL_contacts_contactsNotModified.class);
classStore.put(TLRPC.TL_inputPrivacyKeyStatusTimestamp.constructor, TLRPC.TL_inputPrivacyKeyStatusTimestamp.class);
classStore.put(TLRPC.TL_photos_photos.constructor, TLRPC.TL_photos_photos.class);
classStore.put(TLRPC.TL_photos_photosSlice.constructor, TLRPC.TL_photos_photosSlice.class);
classStore.put(TLRPC.TL_chatFull.constructor, TLRPC.TL_chatFull.class);
@ -165,6 +174,12 @@ public class TLClassStore {
classStore.put(TLRPC.TL_messages_affectedHistory.constructor, TLRPC.TL_messages_affectedHistory.class);
classStore.put(TLRPC.TL_documentEmpty.constructor, TLRPC.TL_documentEmpty.class);
classStore.put(TLRPC.TL_document.constructor, TLRPC.TL_document.class);
classStore.put(TLRPC.TL_inputPrivacyValueDisallowUsers.constructor, TLRPC.TL_inputPrivacyValueDisallowUsers.class);
classStore.put(TLRPC.TL_inputPrivacyValueDisallowAll.constructor, TLRPC.TL_inputPrivacyValueDisallowAll.class);
classStore.put(TLRPC.TL_inputPrivacyValueDisallowContacts.constructor, TLRPC.TL_inputPrivacyValueDisallowContacts.class);
classStore.put(TLRPC.TL_inputPrivacyValueAllowAll.constructor, TLRPC.TL_inputPrivacyValueAllowAll.class);
classStore.put(TLRPC.TL_inputPrivacyValueAllowContacts.constructor, TLRPC.TL_inputPrivacyValueAllowContacts.class);
classStore.put(TLRPC.TL_inputPrivacyValueAllowUsers.constructor, TLRPC.TL_inputPrivacyValueAllowUsers.class);
classStore.put(TLRPC.TL_inputMediaContact.constructor, TLRPC.TL_inputMediaContact.class);
classStore.put(TLRPC.TL_inputMediaUploadedThumbDocument.constructor, TLRPC.TL_inputMediaUploadedThumbDocument.class);
classStore.put(TLRPC.TL_inputMediaAudio.constructor, TLRPC.TL_inputMediaAudio.class);
@ -187,9 +202,12 @@ public class TLClassStore {
classStore.put(TLRPC.TL_contactSuggested.constructor, TLRPC.TL_contactSuggested.class);
classStore.put(TLRPC.TL_server_DH_params_fail.constructor, TLRPC.TL_server_DH_params_fail.class);
classStore.put(TLRPC.TL_server_DH_params_ok.constructor, TLRPC.TL_server_DH_params_ok.class);
classStore.put(TLRPC.TL_userStatusEmpty.constructor, TLRPC.TL_userStatusEmpty.class);
classStore.put(TLRPC.TL_userStatusOnline.constructor, TLRPC.TL_userStatusOnline.class);
classStore.put(TLRPC.TL_userStatusOffline.constructor, TLRPC.TL_userStatusOffline.class);
classStore.put(TLRPC.TL_userStatusLastWeek.constructor, TLRPC.TL_userStatusLastWeek.class);
classStore.put(TLRPC.TL_userStatusEmpty.constructor, TLRPC.TL_userStatusEmpty.class);
classStore.put(TLRPC.TL_userStatusLastMonth.constructor, TLRPC.TL_userStatusLastMonth.class);
classStore.put(TLRPC.TL_userStatusOnline.constructor, TLRPC.TL_userStatusOnline.class);
classStore.put(TLRPC.TL_userStatusRecently.constructor, TLRPC.TL_userStatusRecently.class);
classStore.put(TLRPC.TL_msg_copy.constructor, TLRPC.TL_msg_copy.class);
classStore.put(TLRPC.TL_contacts_importedContacts.constructor, TLRPC.TL_contacts_importedContacts.class);
classStore.put(TLRPC.TL_futureSalt.constructor, TLRPC.TL_futureSalt.class);
@ -210,6 +228,7 @@ public class TLClassStore {
classStore.put(TLRPC.TL_updateEncryptedChatTyping.constructor, TLRPC.TL_updateEncryptedChatTyping.class);
classStore.put(TLRPC.TL_updateDcOptions.constructor, TLRPC.TL_updateDcOptions.class);
classStore.put(TLRPC.TL_updateChatParticipants.constructor, TLRPC.TL_updateChatParticipants.class);
classStore.put(TLRPC.TL_updatePrivacy.constructor, TLRPC.TL_updatePrivacy.class);
classStore.put(TLRPC.TL_updateEncryption.constructor, TLRPC.TL_updateEncryption.class);
classStore.put(TLRPC.TL_updateUserBlocked.constructor, TLRPC.TL_updateUserBlocked.class);
classStore.put(TLRPC.TL_updateActivation.constructor, TLRPC.TL_updateActivation.class);
@ -328,6 +347,7 @@ public class TLClassStore {
classStore.put(TLRPC.TL_inputPhotoEmpty.constructor, TLRPC.TL_inputPhotoEmpty.class);
classStore.put(TLRPC.TL_inputPhoto.constructor, TLRPC.TL_inputPhoto.class);
classStore.put(TLRPC.TL_importedContact.constructor, TLRPC.TL_importedContact.class);
classStore.put(TLRPC.TL_accountDaysTTL.constructor, TLRPC.TL_accountDaysTTL.class);
classStore.put(TLRPC.TL_inputPeerContact.constructor, TLRPC.TL_inputPeerContact.class);
classStore.put(TLRPC.TL_inputPeerChat.constructor, TLRPC.TL_inputPeerChat.class);
classStore.put(TLRPC.TL_inputPeerEmpty.constructor, TLRPC.TL_inputPeerEmpty.class);

View File

@ -769,6 +769,51 @@ public class TLRPC {
}
}
public static class TL_privacyKeyStatusTimestamp extends TLObject {
public static int constructor = 0xbc2eab30;
public void serializeToStream(AbsSerializedData stream) {
stream.writeInt32(constructor);
}
}
public static class TL_account_privacyRules extends TLObject {
public static int constructor = 0x554abb6f;
public ArrayList<PrivacyRule> rules = new ArrayList<PrivacyRule>();
public ArrayList<User> users = new ArrayList<User>();
public void readParams(AbsSerializedData stream) {
stream.readInt32();
int count = stream.readInt32();
for (int a = 0; a < count; a++) {
rules.add((PrivacyRule)TLClassStore.Instance().TLdeserialize(stream, stream.readInt32()));
}
stream.readInt32();
count = stream.readInt32();
for (int a = 0; a < count; a++) {
users.add((User)TLClassStore.Instance().TLdeserialize(stream, stream.readInt32()));
}
}
public void serializeToStream(AbsSerializedData stream) {
stream.writeInt32(constructor);
stream.writeInt32(0x1cb5c415);
int count = rules.size();
stream.writeInt32(count);
for (int a = 0; a < count; a++) {
rules.get(a).serializeToStream(stream);
}
stream.writeInt32(0x1cb5c415);
count = users.size();
stream.writeInt32(count);
for (int a = 0; a < count; a++) {
users.get(a).serializeToStream(stream);
}
}
}
public static class help_AppUpdate extends TLObject {
public int id;
public boolean critical;
@ -1434,6 +1479,92 @@ public class TLRPC {
}
}
public static class PrivacyRule extends TLObject {
public ArrayList<Integer> users = new ArrayList<Integer>();
}
public static class TL_privacyValueAllowUsers extends PrivacyRule {
public static int constructor = 0x4d5bbe0c;
public void readParams(AbsSerializedData stream) {
stream.readInt32();
int count = stream.readInt32();
for (int a = 0; a < count; a++) {
users.add(stream.readInt32());
}
}
public void serializeToStream(AbsSerializedData stream) {
stream.writeInt32(constructor);
stream.writeInt32(0x1cb5c415);
int count = users.size();
stream.writeInt32(count);
for (Integer user : users) {
stream.writeInt32(user);
}
}
}
public static class TL_privacyValueDisallowAll extends PrivacyRule {
public static int constructor = 0x8b73e763;
public void serializeToStream(AbsSerializedData stream) {
stream.writeInt32(constructor);
}
}
public static class TL_privacyValueAllowContacts extends PrivacyRule {
public static int constructor = 0xfffe1bac;
public void serializeToStream(AbsSerializedData stream) {
stream.writeInt32(constructor);
}
}
public static class TL_privacyValueDisallowContacts extends PrivacyRule {
public static int constructor = 0xf888fa1a;
public void serializeToStream(AbsSerializedData stream) {
stream.writeInt32(constructor);
}
}
public static class TL_privacyValueAllowAll extends PrivacyRule {
public static int constructor = 0x65427b82;
public void serializeToStream(AbsSerializedData stream) {
stream.writeInt32(constructor);
}
}
public static class TL_privacyValueDisallowUsers extends PrivacyRule {
public static int constructor = 0xc7f49b7;
public void readParams(AbsSerializedData stream) {
stream.readInt32();
int count = stream.readInt32();
for (int a = 0; a < count; a++) {
users.add(stream.readInt32());
}
}
public void serializeToStream(AbsSerializedData stream) {
stream.writeInt32(constructor);
stream.writeInt32(0x1cb5c415);
int count = users.size();
stream.writeInt32(count);
for (Integer user : users) {
stream.writeInt32(user);
}
}
}
public static class contacts_Contacts extends TLObject {
public ArrayList<TL_contact> contacts = new ArrayList<TL_contact>();
public ArrayList<User> users = new ArrayList<User>();
@ -1482,6 +1613,15 @@ public class TLRPC {
}
}
public static class TL_inputPrivacyKeyStatusTimestamp extends TLObject {
public static int constructor = 0x4f96cb18;
public void serializeToStream(AbsSerializedData stream) {
stream.writeInt32(constructor);
}
}
public static class photos_Photos extends TLObject {
public ArrayList<Photo> photos = new ArrayList<Photo>();
public ArrayList<User> users = new ArrayList<User>();
@ -2841,6 +2981,92 @@ public class TLRPC {
}
}
public static class InputPrivacyRule extends TLObject {
public ArrayList<InputUser> users = new ArrayList<InputUser>();
}
public static class TL_inputPrivacyValueDisallowUsers extends InputPrivacyRule {
public static int constructor = 0x90110467;
public void readParams(AbsSerializedData stream) {
stream.readInt32();
int count = stream.readInt32();
for (int a = 0; a < count; a++) {
users.add((InputUser)TLClassStore.Instance().TLdeserialize(stream, stream.readInt32()));
}
}
public void serializeToStream(AbsSerializedData stream) {
stream.writeInt32(constructor);
stream.writeInt32(0x1cb5c415);
int count = users.size();
stream.writeInt32(count);
for (InputUser user : users) {
user.serializeToStream(stream);
}
}
}
public static class TL_inputPrivacyValueDisallowAll extends InputPrivacyRule {
public static int constructor = 0xd66b66c9;
public void serializeToStream(AbsSerializedData stream) {
stream.writeInt32(constructor);
}
}
public static class TL_inputPrivacyValueDisallowContacts extends InputPrivacyRule {
public static int constructor = 0xba52007;
public void serializeToStream(AbsSerializedData stream) {
stream.writeInt32(constructor);
}
}
public static class TL_inputPrivacyValueAllowAll extends InputPrivacyRule {
public static int constructor = 0x184b35ce;
public void serializeToStream(AbsSerializedData stream) {
stream.writeInt32(constructor);
}
}
public static class TL_inputPrivacyValueAllowContacts extends InputPrivacyRule {
public static int constructor = 0xd09e07b;
public void serializeToStream(AbsSerializedData stream) {
stream.writeInt32(constructor);
}
}
public static class TL_inputPrivacyValueAllowUsers extends InputPrivacyRule {
public static int constructor = 0x131cc67f;
public void readParams(AbsSerializedData stream) {
stream.readInt32();
int count = stream.readInt32();
for (int a = 0; a < count; a++) {
users.add((InputUser)TLClassStore.Instance().TLdeserialize(stream, stream.readInt32()));
}
}
public void serializeToStream(AbsSerializedData stream) {
stream.writeInt32(constructor);
stream.writeInt32(0x1cb5c415);
int count = users.size();
stream.writeInt32(count);
for (InputUser user : users) {
user.serializeToStream(stream);
}
}
}
public static class InputMedia extends TLObject {
public String phone_number;
public String first_name;
@ -3449,6 +3675,8 @@ public class TLRPC {
public long random_id;
public ArrayList<TL_dcOption> dc_options = new ArrayList<TL_dcOption>();
public ChatParticipants participants;
public TL_privacyKeyStatusTimestamp key;
public ArrayList<PrivacyRule> rules = new ArrayList<PrivacyRule>();
public EncryptedChat chat;
public boolean blocked;
public long auth_key_id;
@ -3781,6 +4009,31 @@ public class TLRPC {
}
}
public static class TL_updatePrivacy extends Update {
public static int constructor = 0xee3b272a;
public void readParams(AbsSerializedData stream) {
key = (TL_privacyKeyStatusTimestamp)TLClassStore.Instance().TLdeserialize(stream, stream.readInt32());
stream.readInt32();
int count = stream.readInt32();
for (int a = 0; a < count; a++) {
rules.add((PrivacyRule)TLClassStore.Instance().TLdeserialize(stream, stream.readInt32()));
}
}
public void serializeToStream(AbsSerializedData stream) {
stream.writeInt32(constructor);
key.serializeToStream(stream);
stream.writeInt32(0x1cb5c415);
int count = rules.size();
stream.writeInt32(count);
for (PrivacyRule rule : rules) {
rule.serializeToStream(stream);
}
}
}
public static class TL_updateEncryption extends Update {
public static int constructor = 0xb4a2e88d;
@ -4627,6 +4880,107 @@ public class TLRPC {
}
}
public static class TL_account_getPrivacy extends TLObject {
public static int constructor = 0xdadbc950;
public TL_inputPrivacyKeyStatusTimestamp key;
public Class responseClass () {
return TL_account_privacyRules.class;
}
public void readParams(AbsSerializedData stream) {
key = (TL_inputPrivacyKeyStatusTimestamp)TLClassStore.Instance().TLdeserialize(stream, stream.readInt32());
}
public void serializeToStream(AbsSerializedData stream) {
stream.writeInt32(constructor);
key.serializeToStream(stream);
}
}
public static class TL_account_setPrivacy extends TLObject {
public static int constructor = 0xc9f81ce8;
public TL_inputPrivacyKeyStatusTimestamp key;
public ArrayList<InputPrivacyRule> rules = new ArrayList<InputPrivacyRule>();
public Class responseClass () {
return TL_account_privacyRules.class;
}
public void readParams(AbsSerializedData stream) {
key = (TL_inputPrivacyKeyStatusTimestamp)TLClassStore.Instance().TLdeserialize(stream, stream.readInt32());
stream.readInt32();
int count = stream.readInt32();
for (int a = 0; a < count; a++) {
rules.add((InputPrivacyRule)TLClassStore.Instance().TLdeserialize(stream, stream.readInt32()));
}
}
public void serializeToStream(AbsSerializedData stream) {
stream.writeInt32(constructor);
key.serializeToStream(stream);
stream.writeInt32(0x1cb5c415);
int count = rules.size();
stream.writeInt32(count);
for (InputPrivacyRule rule : rules) {
rule.serializeToStream(stream);
}
}
}
public static class TL_account_deleteAccount extends TLObject {
public static int constructor = 0x418d4e0b;
public String reason;
public Class responseClass () {
return Bool.class;
}
public void readParams(AbsSerializedData stream) {
reason = stream.readString();
}
public void serializeToStream(AbsSerializedData stream) {
stream.writeInt32(constructor);
stream.writeString(reason);
}
}
public static class TL_account_getAccountTTL extends TLObject {
public static int constructor = 0x8fc711d;
public Class responseClass () {
return TL_accountDaysTTL.class;
}
public void serializeToStream(AbsSerializedData stream) {
stream.writeInt32(constructor);
}
}
public static class TL_account_setAccountTTL extends TLObject {
public static int constructor = 0x2442485e;
public TL_accountDaysTTL ttl;
public Class responseClass () {
return Bool.class;
}
public void readParams(AbsSerializedData stream) {
ttl = (TL_accountDaysTTL)TLClassStore.Instance().TLdeserialize(stream, stream.readInt32());
}
public void serializeToStream(AbsSerializedData stream) {
stream.writeInt32(constructor);
ttl.serializeToStream(stream);
}
}
public static class TL_account_checkUsername extends TLObject {
public static int constructor = 0x2714d86c;
@ -6267,6 +6621,21 @@ public class TLRPC {
}
}
public static class TL_accountDaysTTL extends TLObject {
public static int constructor = 0xb8d0afdf;
public int days;
public void readParams(AbsSerializedData stream) {
days = stream.readInt32();
}
public void serializeToStream(AbsSerializedData stream) {
stream.writeInt32(constructor);
stream.writeInt32(days);
}
}
public static class InputPeer extends TLObject {
public int user_id;
public int chat_id;
@ -8744,6 +9113,15 @@ public class TLRPC {
public int expires;
}
public static class TL_userStatusLastWeek extends UserStatus {
public static int constructor = 0x7bf09fc;
public void serializeToStream(AbsSerializedData stream) {
stream.writeInt32(constructor);
}
}
public static class TL_userStatusEmpty extends UserStatus {
public static int constructor = 0x9d05049;
@ -8753,6 +9131,15 @@ public class TLRPC {
}
}
public static class TL_userStatusLastMonth extends UserStatus {
public static int constructor = 0x77ebc742;
public void serializeToStream(AbsSerializedData stream) {
stream.writeInt32(constructor);
}
}
public static class TL_userStatusOnline extends UserStatus {
public static int constructor = 0xedb93949;
@ -8767,6 +9154,15 @@ public class TLRPC {
}
}
public static class TL_userStatusRecently extends UserStatus {
public static int constructor = 0xe26f42f1;
public void serializeToStream(AbsSerializedData stream) {
stream.writeInt32(constructor);
}
}
public static class TL_userStatusOffline extends UserStatus {
public static int constructor = 0x8c703f;
@ -9879,13 +10275,15 @@ public class TLRPC {
}
}
public static class invokeWithLayer18 extends TLObject {
public static int constructor = 0x1c900537;
public static class invokeWithLayer extends TLObject {
public static int constructor = 0xda9b0d0d;
public int layer = 19;
public TLObject query;
public void serializeToStream(AbsSerializedData stream) {
stream.writeInt32(constructor);
stream.writeInt32(layer);
query.serializeToStream(stream);
}
}

View File

@ -190,6 +190,7 @@ public class ActionBar extends FrameLayout {
titleFrameLayout.addView(backButtonImageView);
backButtonImageView.setVisibility(VISIBLE);
backButtonImageView.setScaleType(ImageView.ScaleType.CENTER);
backButtonImageView.setBackgroundResource(itemsBackgroundResourceId);
backButtonImageView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
@ -505,7 +506,7 @@ public class ActionBar extends FrameLayout {
public void setItemsBackground(int resourceId) {
itemsBackgroundResourceId = resourceId;
if (backButtonImageView != null) {
backButtonImageView.setBackgroundResource(resourceId);
backButtonImageView.setBackgroundResource(itemsBackgroundResourceId);
}
}

View File

@ -63,6 +63,10 @@ public class ActionBarMenu extends LinearLayout {
}
public ActionBarMenuItem addItem(int id, int icon, int backgroundResource) {
return addItem(id, icon, parentActionBar.itemsBackgroundResourceId, AndroidUtilities.dp(48));
}
public ActionBarMenuItem addItem(int id, int icon, int backgroundResource, int width) {
ActionBarMenuItem menuItem = new ActionBarMenuItem(getContext(), this, backgroundResource);
menuItem.setTag(id);
menuItem.setScaleType(ImageView.ScaleType.CENTER);
@ -70,7 +74,7 @@ public class ActionBarMenu extends LinearLayout {
addView(menuItem);
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams)menuItem.getLayoutParams();
layoutParams.height = FrameLayout.LayoutParams.MATCH_PARENT;
layoutParams.width = AndroidUtilities.dp(48);
layoutParams.width = width;
menuItem.setLayoutParams(layoutParams);
menuItem.setOnClickListener(new OnClickListener() {
@Override

View File

@ -53,6 +53,8 @@ public class ActionBarMenuItem extends ImageView {
private int[] location;
private View selectedMenuView;
private Runnable showMenuRunnable;
private boolean showFromBottom;
private int height;
public ActionBarMenuItem(Context context, ActionBarMenu menu, int background) {
super(context);
@ -129,6 +131,10 @@ public class ActionBarMenuItem extends ImageView {
return super.onTouchEvent(event);
}
public void setShowFromBottom(boolean value) {
showFromBottom = value;
}
public void addSubItem(int id, String text, int icon) {
if (popupLayout == null) {
rect = new Rect();
@ -238,10 +244,23 @@ public class ActionBarMenuItem extends ImageView {
}
popupWindow.setFocusable(true);
if (popupLayout.getMeasuredWidth() == 0) {
popupWindow.showAsDropDown(this, parentMenu.parentActionBar.getMeasuredWidth() - popupLayout.getMeasuredWidth() - getLeft() - parentMenu.getLeft(), -getMeasuredHeight());
popupWindow.update(this, parentMenu.parentActionBar.getMeasuredWidth() - popupLayout.getMeasuredWidth() - getLeft() - parentMenu.getLeft(), -getMeasuredHeight(), -1, -1);
if (showFromBottom) {
popupWindow.showAsDropDown(this, -popupLayout.getMeasuredWidth() + getMeasuredWidth() + AndroidUtilities.dp(12), -popupLayout.getMeasuredHeight() + AndroidUtilities.dp(12));
popupWindow.update(this, -popupLayout.getMeasuredWidth() + getMeasuredWidth() + AndroidUtilities.dp(12), -popupLayout.getMeasuredHeight() + AndroidUtilities.dp(12), -1, -1);
height = popupLayout.getMeasuredHeight();
} else {
popupWindow.showAsDropDown(this, parentMenu.parentActionBar.getMeasuredWidth() - popupLayout.getMeasuredWidth() - getLeft() - parentMenu.getLeft(), -getMeasuredHeight());
popupWindow.update(this, parentMenu.parentActionBar.getMeasuredWidth() - popupLayout.getMeasuredWidth() - getLeft() - parentMenu.getLeft(), -getMeasuredHeight(), -1, -1);
}
} else {
popupWindow.showAsDropDown(this, parentMenu.parentActionBar.getMeasuredWidth() - popupLayout.getMeasuredWidth() - getLeft() - parentMenu.getLeft(), -getMeasuredHeight());
if (showFromBottom) {
if (height == 0) {
height = popupLayout.getMeasuredHeight();
}
popupWindow.showAsDropDown(this, -popupLayout.getMeasuredWidth() + getMeasuredWidth() + AndroidUtilities.dp(12), -height + AndroidUtilities.dp(12));
} else {
popupWindow.showAsDropDown(this, parentMenu.parentActionBar.getMeasuredWidth() - popupLayout.getMeasuredWidth() - getLeft() - parentMenu.getLeft(), -getMeasuredHeight());
}
}
}
@ -287,7 +306,7 @@ public class ActionBarMenuItem extends ImageView {
searchField.setTextColor(0xffffffff);
searchField.setSingleLine(true);
searchField.setBackgroundResource(R.drawable.search_light_states);
searchField.setPadding(AndroidUtilities.dp(6), 0, AndroidUtilities.dp(6), 0);
searchField.setPadding(0, 0, 0, 0);
searchField.setInputType(EditorInfo.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
if (android.os.Build.VERSION.SDK_INT < 11) {
searchField.setOnCreateContextMenuListener(new OnCreateContextMenuListener() {
@ -366,7 +385,8 @@ public class ActionBarMenuItem extends ImageView {
layoutParams.width = 0;
layoutParams.gravity = Gravity.CENTER_VERTICAL;
layoutParams.height = AndroidUtilities.dp(36);
layoutParams.rightMargin = AndroidUtilities.dp(16);
layoutParams.rightMargin = AndroidUtilities.dp(22);
layoutParams.leftMargin = AndroidUtilities.dp(6);
searchField.setLayoutParams(layoutParams);
searchField.setVisibility(GONE);
}
@ -386,9 +406,11 @@ public class ActionBarMenuItem extends ImageView {
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
if (popupWindow != null && popupWindow.isShowing()) {
int x = parentMenu.parentActionBar.getMeasuredWidth() - popupLayout.getMeasuredWidth() - getLeft() - parentMenu.getLeft();
int y = -getMeasuredHeight();
popupWindow.update(this, parentMenu.parentActionBar.getMeasuredWidth() - popupLayout.getMeasuredWidth() - getLeft() - parentMenu.getLeft(), -getMeasuredHeight(), -1, -1);
if (showFromBottom) {
popupWindow.update(this, -popupLayout.getMeasuredWidth() + getMeasuredWidth() + AndroidUtilities.dp(12), -height + AndroidUtilities.dp(12), -1, -1);
} else {
popupWindow.update(this, parentMenu.parentActionBar.getMeasuredWidth() - popupLayout.getMeasuredWidth() - getLeft() - parentMenu.getLeft(), -getMeasuredHeight(), -1, -1);
}
}
}

View File

@ -34,6 +34,7 @@ public class ContactsAdapter extends BaseSectionsAdapter {
private boolean onlyUsers;
private boolean needPhonebook;
private HashMap<Integer, TLRPC.User> ignoreUsers;
private HashMap<Integer, ?> checkedMap;
public ContactsAdapter(Context context, boolean arg1, boolean arg2, HashMap<Integer, TLRPC.User> arg3) {
mContext = context;
@ -42,6 +43,10 @@ public class ContactsAdapter extends BaseSectionsAdapter {
ignoreUsers = arg3;
}
public void setCheckedMap(HashMap<Integer, ?> map) {
checkedMap = map;
}
@Override
public Object getItem(int section, int position) {
if (onlyUsers) {
@ -212,6 +217,9 @@ public class ContactsAdapter extends BaseSectionsAdapter {
ArrayList<TLRPC.TL_contact> arr = ContactsController.getInstance().usersSectionsDict.get(ContactsController.getInstance().sortedUsersSectionsArray.get(section - (onlyUsers ? 0 : 1)));
TLRPC.User user = MessagesController.getInstance().getUser(arr.get(position).user_id);
((UserCell)convertView).setData(user, null, null, 0);
if (checkedMap != null) {
((UserCell) convertView).setChecked(checkedMap.containsKey(user.id));
}
if (ignoreUsers != null) {
if (ignoreUsers.containsKey(user.id)) {
ViewProxy.setAlpha(convertView, 0.5f);

View File

@ -36,6 +36,7 @@ public class ContactsSearchAdapter extends BaseContactsSearchAdapter {
private HashMap<Integer, TLRPC.User> ignoreUsers;
private ArrayList<TLRPC.User> searchResult = new ArrayList<TLRPC.User>();
private ArrayList<CharSequence> searchResultNames = new ArrayList<CharSequence>();
private HashMap<Integer, ?> checkedMap;
private Timer searchTimer;
private boolean allowUsernameSearch;
private boolean useUserCell;
@ -46,6 +47,10 @@ public class ContactsSearchAdapter extends BaseContactsSearchAdapter {
allowUsernameSearch = usernameSearch;
}
public void setCheckedMap(HashMap<Integer, ?> map) {
checkedMap = map;
}
public void setUseUserCell(boolean value) {
useUserCell = value;
}
@ -238,6 +243,9 @@ public class ContactsSearchAdapter extends BaseContactsSearchAdapter {
if (useUserCell) {
((UserCell) view).setData(user, name, username, 0);
if (checkedMap != null) {
((UserCell) view).setChecked(checkedMap.containsKey(user.id));
}
} else {
((ProfileSearchCell) view).useSeparator = (i != getCount() - 1 && i != searchResult.size() - 1);
if (ignoreUsers != null) {

View File

@ -136,7 +136,7 @@ public class DialogsAdapter extends BaseFragmentAdapter {
@Override
public boolean isEmpty() {
if (MessagesController.getInstance().loadingDialogs && MessagesController.getInstance().dialogs.isEmpty()) {
return false;
return true;
}
int count;
if (serverOnly) {

View File

@ -33,6 +33,7 @@ import org.telegram.android.ImageReceiver;
import org.telegram.ui.Views.AvatarDrawable;
public class DialogCell extends BaseCell {
private static TextPaint namePaint;
private static TextPaint nameEncryptedPaint;
private static TextPaint nameUnknownPaint;

View File

@ -12,7 +12,6 @@ import android.content.Context;
import android.text.TextUtils;
import android.util.TypedValue;
import android.view.Gravity;
import android.widget.CheckBox;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
@ -27,6 +26,7 @@ import org.telegram.messenger.TLRPC;
import org.telegram.messenger.UserConfig;
import org.telegram.ui.Views.AvatarDrawable;
import org.telegram.ui.Views.BackupImageView;
import org.telegram.ui.Views.CheckBox;
public class UserCell extends FrameLayout {
@ -111,6 +111,18 @@ public class UserCell extends FrameLayout {
layoutParams.rightMargin = AndroidUtilities.dp(LocaleController.isRTL ? 16 : 0);
layoutParams.gravity = (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL;
imageView.setLayoutParams(layoutParams);
checkBox = new CheckBox(context);
checkBox.setVisibility(GONE);
addView(checkBox);
layoutParams = (LayoutParams) checkBox.getLayoutParams();
layoutParams.width = AndroidUtilities.dp(22);
layoutParams.height = AndroidUtilities.dp(22);
layoutParams.topMargin = AndroidUtilities.dp(38);
layoutParams.leftMargin = LocaleController.isRTL ? 0 : AndroidUtilities.dp(37 + padding);
layoutParams.rightMargin = LocaleController.isRTL ? AndroidUtilities.dp(37 + padding) : 0;
layoutParams.gravity = (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
checkBox.setLayoutParams(layoutParams);
}
public void setData(TLRPC.User user, CharSequence name, CharSequence status, int resId) {
@ -130,6 +142,13 @@ public class UserCell extends FrameLayout {
update(0);
}
public void setChecked(boolean checked) {
if (checkBox.getVisibility() != VISIBLE) {
checkBox.setVisibility(VISIBLE);
}
checkBox.setChecked(checked);
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();

View File

@ -74,7 +74,7 @@ public class ChangeChatNameActivity extends BaseFragment {
});
ActionBarMenu menu = actionBar.createMenu();
doneButton = menu.addItem(done_button, R.drawable.ic_done);
doneButton = menu.addItem(done_button, R.drawable.ic_done, 0, AndroidUtilities.dp(56));
TLRPC.Chat currentChat = MessagesController.getInstance().getChat(chat_id);

View File

@ -67,7 +67,7 @@ public class ChangeNameActivity extends BaseFragment {
});
ActionBarMenu menu = actionBar.createMenu();
doneButton = menu.addItem(done_button, R.drawable.ic_done);
doneButton = menu.addItem(done_button, R.drawable.ic_done, 0, AndroidUtilities.dp(56));
fragmentView = inflater.inflate(R.layout.contact_add_layout, container, false);

View File

@ -77,7 +77,7 @@ public class ChangeUsernameActivity extends BaseFragment {
});
ActionBarMenu menu = actionBar.createMenu();
doneButton = menu.addItem(done_button, R.drawable.ic_done);
doneButton = menu.addItem(done_button, R.drawable.ic_done, 0, AndroidUtilities.dp(56));
TLRPC.User user = MessagesController.getInstance().getUser(UserConfig.getClientUserId());
if (user == null) {

View File

@ -29,6 +29,7 @@ import android.provider.MediaStore;
import android.text.Html;
import android.text.TextUtils;
import android.util.SparseArray;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.MotionEvent;
@ -42,7 +43,6 @@ import android.widget.AdapterView;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
@ -112,7 +112,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
private TypingDotsDrawable typingDotsDrawable;
private View emptyViewContainer;
private ArrayList<View> actionModeViews = new ArrayList<View>();
private TextView nameTextView;
private TextView onlineTextView;
private FrameLayout avatarContainer;
private TextView bottomOverlayText;
private MessageObject selectedObject;
@ -186,7 +188,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
private final static int attach_video = 8;
private final static int attach_document = 9;
private final static int attach_location = 10;
private final static int chat_menu_avatar = 11;
AdapterView.OnItemLongClickListener onItemLongClickListener = new AdapterView.OnItemLongClickListener() {
@Override
@ -549,31 +550,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
});
presentFragment(fragment);
} else if (id == chat_menu_avatar) {
if (currentUser != null) {
Bundle args = new Bundle();
args.putInt("user_id", currentUser.id);
if (currentEncryptedChat != null) {
args.putLong("dialog_id", dialog_id);
}
presentFragment(new ProfileActivity(args));
} else if (currentChat != null) {
if (info != null && info instanceof TLRPC.TL_chatParticipantsForbidden) {
return;
}
int count = currentChat.participants_count;
if (info != null) {
count = info.participants.size();
}
if (count == 0 || currentChat.left || currentChat instanceof TLRPC.TL_chatForbidden) {
return;
}
Bundle args = new Bundle();
args.putInt("chat_id", currentChat.id);
ProfileActivity fragment = new ProfileActivity(args);
fragment.setChatInfo(info);
presentFragment(fragment);
}
} else if (id == copy) {
String str = "";
ArrayList<Integer> ids = new ArrayList<Integer>(selectedMessagesCanCopyIds.keySet());
@ -634,13 +610,99 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
});
avatarContainer = new FrameLayout(getParentActivity());
actionBar.addView(avatarContainer);
FrameLayout.LayoutParams layoutParams2 = (FrameLayout.LayoutParams) avatarContainer.getLayoutParams();
layoutParams2.height = AndroidUtilities.dp(48);
layoutParams2.width = FrameLayout.LayoutParams.WRAP_CONTENT;
layoutParams2.rightMargin = AndroidUtilities.dp(48 + (currentEncryptedChat != null ? 48 : 0));
layoutParams2.leftMargin = AndroidUtilities.dp(64);
layoutParams2.gravity = Gravity.TOP | Gravity.LEFT;
avatarContainer.setLayoutParams(layoutParams2);
avatarContainer.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (currentUser != null) {
Bundle args = new Bundle();
args.putInt("user_id", currentUser.id);
if (currentEncryptedChat != null) {
args.putLong("dialog_id", dialog_id);
}
presentFragment(new ProfileActivity(args));
} else if (currentChat != null) {
if (info != null && info instanceof TLRPC.TL_chatParticipantsForbidden) {
return;
}
int count = currentChat.participants_count;
if (info != null) {
count = info.participants.size();
}
if (count == 0 || currentChat.left || currentChat instanceof TLRPC.TL_chatForbidden) {
return;
}
Bundle args = new Bundle();
args.putInt("chat_id", currentChat.id);
ProfileActivity fragment = new ProfileActivity(args);
fragment.setChatInfo(info);
presentFragment(fragment);
}
}
});
avatarImageView = new BackupImageView(getParentActivity());
avatarImageView.imageReceiver.setRoundRadius(AndroidUtilities.dp(21));
avatarImageView.processDetach = false;
avatarContainer.addView(avatarImageView);
layoutParams2 = (FrameLayout.LayoutParams) avatarImageView.getLayoutParams();
layoutParams2.width = AndroidUtilities.dp(42);
layoutParams2.height = AndroidUtilities.dp(42);
layoutParams2.topMargin = AndroidUtilities.dp(3);
avatarImageView.setLayoutParams(layoutParams2);
nameTextView = new TextView(getParentActivity());
nameTextView.setTextColor(0xffffffff);
nameTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
nameTextView.setLines(1);
nameTextView.setMaxLines(1);
nameTextView.setSingleLine(true);
nameTextView.setEllipsize(TextUtils.TruncateAt.END);
nameTextView.setGravity(Gravity.LEFT);
nameTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
avatarContainer.addView(nameTextView);
layoutParams2 = (FrameLayout.LayoutParams) nameTextView.getLayoutParams();
layoutParams2.width = FrameLayout.LayoutParams.WRAP_CONTENT;
layoutParams2.height = FrameLayout.LayoutParams.WRAP_CONTENT;
layoutParams2.leftMargin = AndroidUtilities.dp(54);
layoutParams2.bottomMargin = AndroidUtilities.dp(22);
layoutParams2.gravity = Gravity.BOTTOM;
nameTextView.setLayoutParams(layoutParams2);
onlineTextView = new TextView(getParentActivity());
onlineTextView.setTextColor(0xffd7e8f7);
onlineTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
onlineTextView.setLines(1);
onlineTextView.setMaxLines(1);
onlineTextView.setSingleLine(true);
onlineTextView.setEllipsize(TextUtils.TruncateAt.END);
onlineTextView.setGravity(Gravity.LEFT);
avatarContainer.addView(onlineTextView);
layoutParams2 = (FrameLayout.LayoutParams) onlineTextView.getLayoutParams();
layoutParams2.width = FrameLayout.LayoutParams.WRAP_CONTENT;
layoutParams2.height = FrameLayout.LayoutParams.WRAP_CONTENT;
layoutParams2.leftMargin = AndroidUtilities.dp(54);
layoutParams2.bottomMargin = AndroidUtilities.dp(4);
layoutParams2.gravity = Gravity.BOTTOM;
onlineTextView.setLayoutParams(layoutParams2);
updateTitle();
updateSubtitle();
if (currentEncryptedChat != null) {
actionBar.setTitleIcon(R.drawable.ic_lock_white, AndroidUtilities.dp(4));
nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_lock_white, 0, 0, 0);
nameTextView.setCompoundDrawablePadding(AndroidUtilities.dp(4));
} else if (currentChat != null && currentChat.id < 0) {
actionBar.setTitleIcon(R.drawable.broadcast2, AndroidUtilities.dp(4));
nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.broadcast2, 0, 0, 0);
nameTextView.setCompoundDrawablePadding(AndroidUtilities.dp(4));
}
ActionBarMenu menu = actionBar.createMenu();
@ -656,6 +718,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
item.addSubItem(attach_document, LocaleController.getString("ChatDocument", R.string.ChatDocument), R.drawable.ic_ab_doc);
item.addSubItem(attach_location, LocaleController.getString("ChatLocation", R.string.ChatLocation), R.drawable.ic_attach_location);
menuItem = item;
item.setShowFromBottom(true);
item.setBackground(null);
actionModeViews.clear();
@ -704,10 +768,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
actionModeViews.add(actionMode.addItem(delete, R.drawable.ic_ab_fwd_delete, R.drawable.bar_selector_mode));
}
actionMode.getItem(copy).setVisibility(selectedMessagesCanCopyIds.size() != 0 ? View.VISIBLE : View.GONE);
View avatarLayout = menu.addItemResource(chat_menu_avatar, R.layout.chat_header_layout);
avatarImageView = (BackupImageView)avatarLayout.findViewById(R.id.chat_avatar_image);
avatarImageView.processDetach = false;
checkActionBarMenu();
fragmentView = inflater.inflate(R.layout.chat_layout, container, false);
@ -1038,6 +1098,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
updateBottomOverlay();
chatActivityEnterView.setContainerView(getParentActivity(), fragmentView);
chatActivityEnterView.addToAttachLayout(menuItem);
} else {
ViewGroup parent = (ViewGroup)fragmentView.getParent();
if (parent != null) {
@ -1371,16 +1432,16 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
private void updateTitle() {
if (currentChat != null) {
actionBar.setTitle(currentChat.title);
nameTextView.setText(currentChat.title);
} else if (currentUser != null) {
if (currentUser.id / 1000 != 777 && currentUser.id / 1000 != 333 && ContactsController.getInstance().contactsDict.get(currentUser.id) == null && (ContactsController.getInstance().contactsDict.size() != 0 || !ContactsController.getInstance().isLoadingContacts())) {
if (currentUser.phone != null && currentUser.phone.length() != 0) {
actionBar.setTitle(PhoneFormat.getInstance().format("+" + currentUser.phone));
nameTextView.setText(PhoneFormat.getInstance().format("+" + currentUser.phone));
} else {
actionBar.setTitle(ContactsController.formatName(currentUser.first_name, currentUser.last_name));
nameTextView.setText(ContactsController.formatName(currentUser.first_name, currentUser.last_name));
}
} else {
actionBar.setTitle(ContactsController.formatName(currentUser.first_name, currentUser.last_name));
nameTextView.setText(ContactsController.formatName(currentUser.first_name, currentUser.last_name));
}
}
}
@ -1394,18 +1455,18 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
setTypingAnimation(false);
if (currentChat != null) {
if (currentChat instanceof TLRPC.TL_chatForbidden) {
actionBar.setSubtitle(LocaleController.getString("YouWereKicked", R.string.YouWereKicked));
onlineTextView.setText(LocaleController.getString("YouWereKicked", R.string.YouWereKicked));
} else if (currentChat.left) {
actionBar.setSubtitle(LocaleController.getString("YouLeft", R.string.YouLeft));
onlineTextView.setText(LocaleController.getString("YouLeft", R.string.YouLeft));
} else {
int count = currentChat.participants_count;
if (info != null) {
count = info.participants.size();
}
if (onlineCount > 1 && count != 0) {
actionBar.setSubtitle(String.format("%s, %s", LocaleController.formatPluralString("Members", count), LocaleController.formatPluralString("Online", onlineCount)));
onlineTextView.setText(String.format("%s, %s", LocaleController.formatPluralString("Members", count), LocaleController.formatPluralString("Online", onlineCount)));
} else {
actionBar.setSubtitle(LocaleController.formatPluralString("Members", count));
onlineTextView.setText(LocaleController.formatPluralString("Members", count));
}
}
} else if (currentUser != null) {
@ -1415,13 +1476,13 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
if (lastPrintString != null || lastStatus != user.status || lastStatus != null && user.status != null && lastStatus.expires != user.status.expires) {
lastStatus = user.status;
actionBar.setSubtitle(LocaleController.formatUserStatus(currentUser));
onlineTextView.setText(LocaleController.formatUserStatus(currentUser));
}
}
lastPrintString = null;
} else {
lastPrintString = printString;
actionBar.setSubtitle(printString);
onlineTextView.setText(printString);
setTypingAnimation(true);
}
}
@ -1432,13 +1493,15 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
if (start) {
try {
actionBar.setSubTitleIcon(0, typingDotsDrawable, AndroidUtilities.dp(4));
onlineTextView.setCompoundDrawablesWithIntrinsicBounds(typingDotsDrawable, null, null, null);
onlineTextView.setCompoundDrawablePadding(AndroidUtilities.dp(4));
typingDotsDrawable.start();
} catch (Exception e) {
FileLog.e("tmessages", e);
}
} else {
actionBar.setSubTitleIcon(0, null, 0);
onlineTextView.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null);
onlineTextView.setCompoundDrawablePadding(0);
if (typingDotsDrawable != null) {
typingDotsDrawable.stop();
}
@ -2531,28 +2594,24 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
private void fixLayout(final boolean resume) {
if (avatarImageView != null) {
avatarImageView.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
if (avatarContainer != null) {
avatarContainer.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
@Override
public boolean onPreDraw() {
if (avatarImageView != null) {
avatarImageView.getViewTreeObserver().removeOnPreDrawListener(this);
if (avatarContainer != null) {
avatarContainer.getViewTreeObserver().removeOnPreDrawListener(this);
}
if (getParentActivity() == null) {
return false;
}
int height = AndroidUtilities.getCurrentActionBarHeight();
if (!AndroidUtilities.isTablet() && getParentActivity().getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
selectedMessagesCountTextView.setTextSize(16);
} else {
selectedMessagesCountTextView.setTextSize(18);
}
if (avatarImageView != null) {
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) avatarImageView.getLayoutParams();
params.width = height;
params.height = height;
avatarImageView.setLayoutParams(params);
}
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams)avatarContainer.getLayoutParams();
layoutParams.topMargin = (Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0) + (AndroidUtilities.getCurrentActionBarHeight() - AndroidUtilities.dp(48)) / 2;
avatarContainer.setLayoutParams(layoutParams);
return false;
}
});

View File

@ -98,7 +98,7 @@ public class ContactAddActivity extends BaseFragment implements NotificationCent
});
ActionBarMenu menu = actionBar.createMenu();
doneButton = menu.addItem(done_button, R.drawable.ic_done);
doneButton = menu.addItem(done_button, R.drawable.ic_done, 0, AndroidUtilities.dp(56));
fragmentView = inflater.inflate(R.layout.contact_add_layout, container, false);
@ -112,6 +112,7 @@ public class ContactAddActivity extends BaseFragment implements NotificationCent
onlineText = (TextView)fragmentView.findViewById(R.id.settings_online);
avatarImage = (BackupImageView)fragmentView.findViewById(R.id.settings_avatar_image);
avatarImage.processDetach = false;
avatarImage.imageReceiver.setRoundRadius(AndroidUtilities.dp(32));
phoneText = (TextView)fragmentView.findViewById(R.id.settings_name);
Typeface typeface = AndroidUtilities.getTypeface("fonts/rmedium.ttf");
phoneText.setTypeface(typeface);

View File

@ -47,7 +47,6 @@ import org.telegram.messenger.FileLog;
import org.telegram.android.MessagesController;
import org.telegram.android.NotificationCenter;
import org.telegram.messenger.R;
import org.telegram.ui.Adapters.BaseSectionsAdapter;
import org.telegram.ui.Adapters.ContactsAdapter;
import org.telegram.ui.Adapters.ContactsSearchAdapter;
import org.telegram.ui.ActionBar.ActionBar;
@ -85,7 +84,7 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
}
}
private BaseSectionsAdapter listViewAdapter;
private ContactsAdapter listViewAdapter;
private TextView emptyTextView;
private EditText userSelectEditText;
private SectionsListView listView;
@ -98,7 +97,7 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
private boolean searchWas;
private boolean searching;
private CharSequence changeString;
private HashMap<Integer, XImageSpan> selectedContacts = new HashMap<Integer, XImageSpan>();
private HashMap<Integer, XImageSpan> selectedContacts = new HashMap<Integer, XImageSpan>();
private ArrayList<XImageSpan> allSpans = new ArrayList<XImageSpan>();
private final static int done_button = 1;
@ -158,13 +157,13 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
}
});
ActionBarMenu menu = actionBar.createMenu();
View doneItem = menu.addItemResource(done_button, R.layout.group_create_done_layout);
TextView doneTextView = (TextView)doneItem.findViewById(R.id.done_button);
doneTextView.setText(LocaleController.getString("Next", R.string.Next));
menu.addItem(done_button, R.drawable.ic_done, 0, AndroidUtilities.dp(56));
searchListViewAdapter = new ContactsSearchAdapter(getParentActivity(), null, false);
listViewAdapter = new ContactsAdapter(getParentActivity(), true, false, null);
searchListViewAdapter.setCheckedMap(selectedContacts);
searchListViewAdapter.setUseUserCell(true);
listViewAdapter = new ContactsAdapter(getParentActivity(), true, false, null);
listViewAdapter.setCheckedMap(selectedContacts);
fragmentView = new LinearLayout(getParentActivity());
LinearLayout linearLayout = (LinearLayout) fragmentView;
@ -182,19 +181,23 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
userSelectEditText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
userSelectEditText.setHintTextColor(0xffa6a6a6);
userSelectEditText.setTextColor(0xff000000);
userSelectEditText.setMinimumHeight(AndroidUtilities.dp(52));
userSelectEditText.setMaxLines(2);
userSelectEditText.setPadding(userSelectEditText.getPaddingLeft(), AndroidUtilities.dp(3), userSelectEditText.getPaddingRight(), userSelectEditText.getPaddingBottom());
userSelectEditText.setInputType(InputType.TYPE_TEXT_VARIATION_FILTER | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS | InputType.TYPE_TEXT_FLAG_MULTI_LINE);
userSelectEditText.setImeOptions(EditorInfo.IME_ACTION_DONE);
userSelectEditText.setMinimumHeight(AndroidUtilities.dp(54));
userSelectEditText.setSingleLine(false);
userSelectEditText.setLines(2);
userSelectEditText.setMaxLines(2);
userSelectEditText.setVerticalScrollBarEnabled(true);
userSelectEditText.setHorizontalScrollBarEnabled(false);
userSelectEditText.setPadding(0, 0, 0, 0);
userSelectEditText.setImeOptions(EditorInfo.IME_ACTION_DONE | EditorInfo.IME_FLAG_NO_EXTRACT_UI);
userSelectEditText.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL);
AndroidUtilities.clearCursorDrawable(userSelectEditText);
frameLayout.addView(userSelectEditText);
FrameLayout.LayoutParams layoutParams1 = (FrameLayout.LayoutParams) userSelectEditText.getLayoutParams();
layoutParams1.width = FrameLayout.LayoutParams.MATCH_PARENT;
layoutParams1.height = FrameLayout.LayoutParams.WRAP_CONTENT;
layoutParams1.leftMargin = AndroidUtilities.dp(5);
layoutParams1.rightMargin = AndroidUtilities.dp(5);
layoutParams1.leftMargin = AndroidUtilities.dp(10);
layoutParams1.rightMargin = AndroidUtilities.dp(10);
layoutParams1.gravity = Gravity.TOP;
userSelectEditText.setLayoutParams(layoutParams1);
@ -324,16 +327,21 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
/*TLRPC.User user;
int section = listViewAdapter.getSectionForPosition(i);
int row = listViewAdapter.getPositionInSectionForPosition(i);
TLRPC.User user = null;
if (searching && searchWas) {
user = searchResult.get(row);
user = searchListViewAdapter.getItem(i);
} else {
ArrayList<TLRPC.TL_contact> arr = ContactsController.getInstance().usersSectionsDict.get(ContactsController.getInstance().sortedUsersSectionsArray.get(section));
user = MessagesController.getInstance().getUser(arr.get(row).user_id);
listView.invalidateViews();
int section = listViewAdapter.getSectionForPosition(i);
int row = listViewAdapter.getPositionInSectionForPosition(i);
if (row < 0 || section < 0) {
return;
}
user = (TLRPC.User) listViewAdapter.getItem(section, row);
}
if (user == null) {
return;
}
if (selectedContacts.containsKey(user.id)) {
XImageSpan span = selectedContacts.get(user.id);
selectedContacts.remove(user.id);
@ -355,10 +363,6 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
}
actionBar.setSubtitle(LocaleController.formatString("MembersCount", R.string.MembersCount, selectedContacts.size(), maxCount));
if (searching || searchWas) {
searching = false;
searchWas = false;
emptyTextView.setText(LocaleController.getString("NoContacts", R.string.NoContacts));
ignoreChange = true;
SpannableStringBuilder ssb = new SpannableStringBuilder("");
for (ImageSpan sp : allSpans) {
@ -369,10 +373,21 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
userSelectEditText.setSelection(ssb.length());
ignoreChange = false;
searchListViewAdapter.searchDialogs(null);
searching = false;
searchWas = false;
ViewGroup group = (ViewGroup) listView.getParent();
listView.setAdapter(listViewAdapter);
listViewAdapter.notifyDataSetChanged();
if (android.os.Build.VERSION.SDK_INT >= 11) {
listView.setFastScrollAlwaysVisible(true);
}
listView.setFastScrollEnabled(true);
listView.setVerticalScrollBarEnabled(false);
emptyTextView.setText(LocaleController.getString("NoContacts", R.string.NoContacts));
} else {
listView.invalidateViews();
}*/
}
}
});
listView.setOnScrollListener(new AbsListView.OnScrollListener() {

View File

@ -8,17 +8,25 @@
package org.telegram.ui;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.text.Editable;
import android.text.InputType;
import android.text.TextWatcher;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.EditorInfo;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
import org.telegram.android.AndroidUtilities;
import org.telegram.messenger.ConnectionsManager;
@ -30,6 +38,7 @@ import org.telegram.android.MessagesController;
import org.telegram.android.NotificationCenter;
import org.telegram.messenger.R;
import org.telegram.ui.Adapters.BaseFragmentAdapter;
import org.telegram.ui.Cells.GreySectionCell;
import org.telegram.ui.Cells.UserCell;
import org.telegram.ui.ActionBar.ActionBar;
import org.telegram.ui.ActionBar.ActionBarMenu;
@ -175,15 +184,33 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati
});
ActionBarMenu menu = actionBar.createMenu();
View doneItem = menu.addItemResource(done_button, R.layout.group_create_done_layout);
menu.addItem(done_button, R.drawable.ic_done, 0, AndroidUtilities.dp(56));
TextView doneTextView = (TextView)doneItem.findViewById(R.id.done_button);
doneTextView.setText(LocaleController.getString("Done", R.string.Done).toUpperCase());
fragmentView = new LinearLayout(getParentActivity());
LinearLayout linearLayout = (LinearLayout) fragmentView;
linearLayout.setOrientation(LinearLayout.VERTICAL);
fragmentView = inflater.inflate(R.layout.group_create_final_layout, container, false);
FrameLayout frameLayout = new FrameLayout(getParentActivity());
linearLayout.addView(frameLayout);
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) frameLayout.getLayoutParams();
layoutParams.width = LinearLayout.LayoutParams.MATCH_PARENT;
layoutParams.height = LinearLayout.LayoutParams.WRAP_CONTENT;
frameLayout.setLayoutParams(layoutParams);
avatarImage = new BackupImageView(getParentActivity());
avatarDrawable.setInfo(5, null, null, isBroadcast);
avatarImage.setImageDrawable(avatarDrawable);
frameLayout.addView(avatarImage);
FrameLayout.LayoutParams layoutParams1 = (FrameLayout.LayoutParams) avatarImage.getLayoutParams();
layoutParams1.width = AndroidUtilities.dp(64);
layoutParams1.height = AndroidUtilities.dp(64);
layoutParams1.topMargin = AndroidUtilities.dp(12);
layoutParams1.bottomMargin = AndroidUtilities.dp(12);
layoutParams1.leftMargin = AndroidUtilities.dp(16);
avatarImage.setLayoutParams(layoutParams1);
if (!isBroadcast) {
/*button2.setOnClickListener(new View.OnClickListener() {
avatarDrawable.setDrawPhoto(true);
avatarImage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (getParentActivity() == null) {
@ -215,25 +242,66 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati
});
showAlertDialog(builder);
}
});*/
});
}
avatarImage = (BackupImageView)fragmentView.findViewById(R.id.settings_avatar_image);
avatarDrawable.setInfo(3, null, null, isBroadcast);
avatarImage.setImageDrawable(avatarDrawable);
nameTextView = (EditText)fragmentView.findViewById(R.id.bubble_input_text);
if (isBroadcast) {
nameTextView.setHint(LocaleController.getString("EnterListName", R.string.EnterListName));
} else {
nameTextView.setHint(LocaleController.getString("EnterGroupNamePlaceholder", R.string.EnterGroupNamePlaceholder));
}
nameTextView = new EditText(getParentActivity());
nameTextView.setHint(isBroadcast ? LocaleController.getString("EnterListName", R.string.EnterListName) : LocaleController.getString("EnterGroupNamePlaceholder", R.string.EnterGroupNamePlaceholder));
if (nameToSet != null) {
nameTextView.setText(nameToSet);
nameToSet = null;
}
listView = (ListView)fragmentView.findViewById(R.id.listView);
nameTextView.setMaxLines(4);
nameTextView.setGravity(Gravity.CENTER_VERTICAL | Gravity.LEFT);
nameTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
nameTextView.setHintTextColor(0xffa6a6a6);
nameTextView.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI);
nameTextView.setInputType(InputType.TYPE_TEXT_FLAG_CAP_SENTENCES);
nameTextView.setPadding(0, 0, 0, AndroidUtilities.dp(8));
AndroidUtilities.clearCursorDrawable(nameTextView);
nameTextView.setTextColor(0xff000000);
frameLayout.addView(nameTextView);
layoutParams1 = (FrameLayout.LayoutParams) nameTextView.getLayoutParams();
layoutParams1.width = FrameLayout.LayoutParams.MATCH_PARENT;
layoutParams1.height = FrameLayout.LayoutParams.WRAP_CONTENT;
layoutParams1.leftMargin = AndroidUtilities.dp(96);
layoutParams1.rightMargin = AndroidUtilities.dp(16);
layoutParams1.gravity = Gravity.CENTER_VERTICAL;
nameTextView.setLayoutParams(layoutParams1);
if (!isBroadcast) {
nameTextView.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
avatarDrawable.setInfo(5, nameTextView.length() > 0 ? nameTextView.getText().toString() : null, null, isBroadcast);
avatarImage.invalidate();
}
});
}
GreySectionCell sectionCell = new GreySectionCell(getParentActivity());
sectionCell.setText(LocaleController.formatPluralString("Members", selectedContacts.size()));
linearLayout.addView(sectionCell);
listView = new ListView(getParentActivity());
listView.setDivider(null);
listView.setDividerHeight(0);
listView.setVerticalScrollBarEnabled(false);
listView.setAdapter(new ListAdapter(getParentActivity()));
linearLayout.addView(listView);
layoutParams = (LinearLayout.LayoutParams) listView.getLayoutParams();
layoutParams.width = LinearLayout.LayoutParams.MATCH_PARENT;
layoutParams.height = LinearLayout.LayoutParams.MATCH_PARENT;
listView.setLayoutParams(layoutParams);
} else {
ViewGroup parent = (ViewGroup)fragmentView.getParent();
if (parent != null) {
@ -359,21 +427,28 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati
@Override
public View getView(int i, View view, ViewGroup viewGroup) {
TLRPC.User user = MessagesController.getInstance().getUser(selectedContacts.get(i));
if (view == null) {
view = new UserCell(mContext, 1);
}
TLRPC.User user = MessagesController.getInstance().getUser(selectedContacts.get(i));
((UserCell) view).setData(user, null, null, 0);
return view;
}
/*
if (convertView == null) {
convertView = new SettingsSectionLayout(mContext);
convertView.setBackgroundColor(0xffffffff);
}
((SettingsSectionLayout) convertView).setText(LocaleController.formatPluralString("Members", selectedContacts.size()).toUpperCase());
return convertView;
*/
@Override
public int getItemViewType(int position) {
return 0;
}
@Override
public int getViewTypeCount() {
return 1;
}
@Override
public int getCount() {
return selectedContacts.size();
}
}
}

View File

@ -305,7 +305,6 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
setContentView(drawerLayoutContainer, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
drawerLayoutContainer.setParentActionBarLayout(actionBarLayout);
drawerLayoutContainer.setAllowOpenDrawer(true);
actionBarLayout.setDrawerLayoutContainer(drawerLayoutContainer);
}
actionBarLayout.init(mainFragmentsStack);
@ -1119,6 +1118,7 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
@Override
public boolean needPresentFragment(BaseFragment fragment, boolean removeLast, boolean forceWithoutAnimation, ActionBarLayout layout) {
drawerLayoutContainer.setAllowOpenDrawer(!(fragment instanceof LoginActivity));
if (AndroidUtilities.isTablet()) {
if (fragment instanceof MessagesActivity) {
MessagesActivity messagesActivity = (MessagesActivity)fragment;
@ -1196,6 +1196,7 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
@Override
public boolean needAddFragmentToStack(BaseFragment fragment, ActionBarLayout layout) {
drawerLayoutContainer.setAllowOpenDrawer(!(fragment instanceof LoginActivity));
if (AndroidUtilities.isTablet()) {
if (fragment instanceof MessagesActivity) {
MessagesActivity messagesActivity = (MessagesActivity)fragment;

File diff suppressed because it is too large Load Diff

View File

@ -1,437 +0,0 @@
/*
* This is the source code of Telegram for Android v. 1.3.2.
* It is licensed under GNU GPL v. 2 or later.
* You should have received a copy of the license in this archive (see LICENSE).
*
* Copyright Nikolai Kudashov, 2013.
*/
package org.telegram.ui;
import android.content.Context;
import android.os.Bundle;
import android.telephony.TelephonyManager;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.widget.AdapterView;
import android.widget.EditText;
import android.widget.TextView;
import org.telegram.android.AndroidUtilities;
import org.telegram.PhoneFormat.PhoneFormat;
import org.telegram.messenger.BuildVars;
import org.telegram.android.LocaleController;
import org.telegram.messenger.TLObject;
import org.telegram.messenger.TLRPC;
import org.telegram.messenger.ConnectionsManager;
import org.telegram.messenger.FileLog;
import org.telegram.messenger.R;
import org.telegram.messenger.RPCRequest;
import org.telegram.ui.ActionBar.BaseFragment;
import org.telegram.ui.Views.SlideView;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Locale;
public class LoginActivityPhoneView extends SlideView implements AdapterView.OnItemSelectedListener {
private EditText codeField;
private EditText phoneField;
private TextView countryButton;
private int countryState = 0;
private ArrayList<String> countriesArray = new ArrayList<String>();
private HashMap<String, String> countriesMap = new HashMap<String, String>();
private HashMap<String, String> codesMap = new HashMap<String, String>();
private HashMap<String, String> languageMap = new HashMap<String, String>();
private boolean ignoreSelection = false;
private boolean ignoreOnTextChange = false;
private boolean ignoreOnPhoneChange = false;
private boolean nextPressed = false;
public LoginActivityPhoneView(Context context) {
super(context);
}
public LoginActivityPhoneView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public LoginActivityPhoneView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@Override
protected void onFinishInflate() {
super.onFinishInflate();
TextView textView = (TextView)findViewById(R.id.login_confirm_text);
textView.setText(LocaleController.getString("StartText", R.string.StartText));
countryButton = (TextView)findViewById(R.id.login_coutry_textview);
countryButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
if (delegate == null) {
return;
}
BaseFragment activity = (BaseFragment)delegate;
CountrySelectActivity fragment = new CountrySelectActivity();
fragment.setCountrySelectActivityDelegate(new CountrySelectActivity.CountrySelectActivityDelegate() {
@Override
public void didSelectCountry(String name) {
selectCountry(name);
phoneField.requestFocus();
}
});
activity.presentFragment(fragment);
}
});
codeField = (EditText)findViewById(R.id.login_county_code_field);
codeField.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
@Override
public void afterTextChanged(Editable editable) {
if (ignoreOnTextChange) {
ignoreOnTextChange = false;
return;
}
ignoreOnTextChange = true;
String text = PhoneFormat.stripExceptNumbers(codeField.getText().toString());
codeField.setText(text);
if (text.length() == 0) {
countryButton.setText(LocaleController.getString("ChooseCountry", R.string.ChooseCountry));
countryState = 1;
} else {
String country = codesMap.get(text);
if (country != null) {
int index = countriesArray.indexOf(country);
if (index != -1) {
ignoreSelection = true;
countryButton.setText(countriesArray.get(index));
updatePhoneField();
countryState = 0;
} else {
countryButton.setText(LocaleController.getString("WrongCountry", R.string.WrongCountry));
countryState = 2;
}
} else {
countryButton.setText(LocaleController.getString("WrongCountry", R.string.WrongCountry));
countryState = 2;
}
codeField.setSelection(codeField.getText().length());
}
}
});
codeField.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
if (i == EditorInfo.IME_ACTION_NEXT) {
phoneField.requestFocus();
return true;
}
return false;
}
});
phoneField = (EditText)findViewById(R.id.login_phone_field);
phoneField.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
if (ignoreOnPhoneChange) {
return;
}
if (count == 1 && after == 0 && s.length() > 1) {
String phoneChars = "0123456789";
String str = s.toString();
String substr = str.substring(start, start + 1);
if (!phoneChars.contains(substr)) {
ignoreOnPhoneChange = true;
StringBuilder builder = new StringBuilder(str);
int toDelete = 0;
for (int a = start; a >= 0; a--) {
substr = str.substring(a, a + 1);
if(phoneChars.contains(substr)) {
break;
}
toDelete++;
}
builder.delete(Math.max(0, start - toDelete), start + 1);
str = builder.toString();
if (PhoneFormat.strip(str).length() == 0) {
phoneField.setText("");
} else {
phoneField.setText(str);
updatePhoneField();
}
ignoreOnPhoneChange = false;
}
}
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
if (ignoreOnPhoneChange) {
return;
}
updatePhoneField();
}
});
if(!isInEditMode()) {
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(getResources().getAssets().open("countries.txt")));
String line;
while ((line = reader.readLine()) != null) {
String[] args = line.split(";");
countriesArray.add(0, args[2]);
countriesMap.put(args[2], args[0]);
codesMap.put(args[0], args[2]);
languageMap.put(args[1], args[2]);
}
} catch (Exception e) {
FileLog.e("tmessages", e);
}
Collections.sort(countriesArray, new Comparator<String>() {
@Override
public int compare(String lhs, String rhs) {
return lhs.compareTo(rhs);
}
});
String country = null;
try {
TelephonyManager telephonyManager = (TelephonyManager)ApplicationLoader.applicationContext.getSystemService(Context.TELEPHONY_SERVICE);
if (telephonyManager != null) {
country = telephonyManager.getSimCountryIso().toUpperCase();
}
} catch (Exception e) {
FileLog.e("tmessages", e);
}
if (country != null) {
String countryName = languageMap.get(country);
if (countryName != null) {
int index = countriesArray.indexOf(countryName);
if (index != -1) {
codeField.setText(countriesMap.get(countryName));
countryState = 0;
}
}
}
if (codeField.length() == 0) {
countryButton.setText(LocaleController.getString("ChooseCountry", R.string.ChooseCountry));
countryState = 1;
}
}
if (codeField.length() != 0) {
AndroidUtilities.showKeyboard(phoneField);
phoneField.requestFocus();
} else {
AndroidUtilities.showKeyboard(codeField);
codeField.requestFocus();
}
phoneField.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
if (i == EditorInfo.IME_ACTION_NEXT) {
delegate.onNextAction();
return true;
}
return false;
}
});
}
public void selectCountry(String name) {
int index = countriesArray.indexOf(name);
if (index != -1) {
ignoreOnTextChange = true;
codeField.setText(countriesMap.get(name));
countryButton.setText(name);
countryState = 0;
}
}
private void updatePhoneField() {
ignoreOnPhoneChange = true;
String codeText = codeField.getText().toString();
String phone = PhoneFormat.getInstance().format("+" + codeText + phoneField.getText().toString());
int idx = phone.indexOf(" ");
if (idx != -1) {
String resultCode = PhoneFormat.stripExceptNumbers(phone.substring(0, idx));
if (!codeText.equals(resultCode)) {
phone = PhoneFormat.getInstance().format(phoneField.getText().toString()).trim();
phoneField.setText(phone);
int len = phoneField.length();
phoneField.setSelection(phoneField.length());
} else {
phoneField.setText(phone.substring(idx).trim());
int len = phoneField.length();
phoneField.setSelection(phoneField.length());
}
} else {
phoneField.setSelection(phoneField.length());
}
ignoreOnPhoneChange = false;
}
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
if (ignoreSelection) {
ignoreSelection = false;
return;
}
ignoreOnTextChange = true;
String str = countriesArray.get(i);
codeField.setText(countriesMap.get(str));
updatePhoneField();
}
@Override
public void onNothingSelected(AdapterView<?> adapterView) {
}
@Override
public void onNextPressed() {
if (nextPressed) {
return;
}
if (countryState == 1) {
delegate.needShowAlert(LocaleController.getString("ChooseCountry", R.string.ChooseCountry));
return;
} else if (countryState == 2) {
delegate.needShowAlert(LocaleController.getString("WrongCountry", R.string.WrongCountry));
return;
}
if (codeField.length() == 0) {
delegate.needShowAlert(LocaleController.getString("InvalidPhoneNumber", R.string.InvalidPhoneNumber));
return;
}
TLRPC.TL_auth_sendCode req = new TLRPC.TL_auth_sendCode();
String phone = PhoneFormat.stripExceptNumbers("" + codeField.getText() + phoneField.getText());
ConnectionsManager.getInstance().applyCountryPortNumber(phone);
req.api_hash = BuildVars.APP_HASH;
req.api_id = BuildVars.APP_ID;
req.sms_type = 0;
req.phone_number = phone;
req.lang_code = LocaleController.getLocaleString(Locale.getDefault());
if (req.lang_code == null || req.lang_code.length() == 0) {
req.lang_code = "en";
}
final Bundle params = new Bundle();
params.putString("phone", "+" + codeField.getText() + phoneField.getText());
params.putString("phoneFormated", phone);
nextPressed = true;
if (delegate != null) {
delegate.needShowProgress();
}
ConnectionsManager.getInstance().performRpc(req, new RPCRequest.RPCRequestDelegate() {
@Override
public void run(final TLObject response, final TLRPC.TL_error error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public void run() {
nextPressed = false;
if (error == null) {
final TLRPC.TL_auth_sentCode res = (TLRPC.TL_auth_sentCode)response;
params.putString("phoneHash", res.phone_code_hash);
params.putInt("calltime", res.send_call_timeout * 1000);
if (res.phone_registered) {
params.putString("registered", "true");
}
if (delegate != null) {
delegate.setPage(1, true, params, false);
}
} else {
if (delegate != null && error.text != null) {
if (error.text.contains("PHONE_NUMBER_INVALID")) {
delegate.needShowAlert(LocaleController.getString("InvalidPhoneNumber", R.string.InvalidPhoneNumber));
} else if (error.text.contains("PHONE_CODE_EMPTY") || error.text.contains("PHONE_CODE_INVALID")) {
delegate.needShowAlert(LocaleController.getString("InvalidCode", R.string.InvalidCode));
} else if (error.text.contains("PHONE_CODE_EXPIRED")) {
delegate.needShowAlert(LocaleController.getString("CodeExpired", R.string.CodeExpired));
} else if (error.text.startsWith("FLOOD_WAIT")) {
delegate.needShowAlert(LocaleController.getString("FloodWait", R.string.FloodWait));
} else {
delegate.needShowAlert(error.text);
}
}
}
if (delegate != null) {
delegate.needHideProgress();
}
}
});
}
}, true, RPCRequest.RPCRequestClassGeneric | RPCRequest.RPCRequestClassFailOnServerErrors | RPCRequest.RPCRequestClassWithoutLogin | RPCRequest.RPCRequestClassTryDifferentDc | RPCRequest.RPCRequestClassEnableUnauthorized);
}
@Override
public void onShow() {
super.onShow();
if (phoneField != null) {
phoneField.requestFocus();
phoneField.setSelection(phoneField.length());
}
}
@Override
public String getHeaderName() {
return LocaleController.getString("YourPhone", R.string.YourPhone);
}
@Override
public void saveStateParams(Bundle bundle) {
String code = codeField.getText().toString();
if (code != null && code.length() != 0) {
bundle.putString("phoneview_code", code);
}
String phone = phoneField.getText().toString();
if (phone != null && phone.length() != 0) {
bundle.putString("phoneview_phone", phone);
}
}
@Override
public void restoreStateParams(Bundle bundle) {
String code = bundle.getString("phoneview_code");
if (code != null) {
codeField.setText(code);
}
String phone = bundle.getString("phoneview_phone");
if (phone != null) {
phoneField.setText(phone);
}
}
}

View File

@ -1,221 +0,0 @@
/*
* This is the source code of Telegram for Android v. 1.3.2.
* It is licensed under GNU GPL v. 2 or later.
* You should have received a copy of the license in this archive (see LICENSE).
*
* Copyright Nikolai Kudashov, 2013.
*/
package org.telegram.ui;
import android.content.Context;
import android.os.Bundle;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.widget.EditText;
import android.widget.TextView;
import org.telegram.android.AndroidUtilities;
import org.telegram.android.LocaleController;
import org.telegram.messenger.TLObject;
import org.telegram.messenger.TLRPC;
import org.telegram.messenger.ConnectionsManager;
import org.telegram.android.ContactsController;
import org.telegram.android.MessagesController;
import org.telegram.android.MessagesStorage;
import org.telegram.messenger.R;
import org.telegram.messenger.RPCRequest;
import org.telegram.messenger.UserConfig;
import org.telegram.ui.Views.SlideView;
import java.util.ArrayList;
public class LoginActivityRegisterView extends SlideView {
private EditText firstNameField;
private EditText lastNameField;
private String requestPhone;
private String phoneHash;
private String phoneCode;
private Bundle currentParams;
private boolean nextPressed = false;
public LoginActivityRegisterView(Context context) {
super(context);
}
public LoginActivityRegisterView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public LoginActivityRegisterView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@Override
protected void onFinishInflate() {
super.onFinishInflate();
firstNameField = (EditText)findViewById(R.id.login_first_name_field);
firstNameField.setHint(LocaleController.getString("FirstName", R.string.FirstName));
lastNameField = (EditText)findViewById(R.id.login_last_name_field);
lastNameField.setHint(LocaleController.getString("LastName", R.string.LastName));
TextView textView = (TextView)findViewById(R.id.login_register_info);
textView.setText(LocaleController.getString("RegisterText", R.string.RegisterText));
TextView wrongNumber = (TextView) findViewById(R.id.changed_mind);
wrongNumber.setText(LocaleController.getString("CancelRegistration", R.string.CancelRegistration));
wrongNumber.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
onBackPressed();
delegate.setPage(0, true, null, true);
}
});
firstNameField.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
if (i == EditorInfo.IME_ACTION_NEXT) {
lastNameField.requestFocus();
return true;
}
return false;
}
});
}
@Override
public void onBackPressed() {
currentParams = null;
}
@Override
public String getHeaderName() {
return LocaleController.getString("YourName", R.string.YourName);
}
@Override
public void onShow() {
super.onShow();
if (firstNameField != null) {
firstNameField.requestFocus();
firstNameField.setSelection(firstNameField.length());
}
}
@Override
public void setParams(Bundle params) {
if (params == null) {
return;
}
firstNameField.setText("");
lastNameField.setText("");
requestPhone = params.getString("phoneFormated");
phoneHash = params.getString("phoneHash");
phoneCode = params.getString("code");
currentParams = params;
}
@Override
public void onNextPressed() {
if (nextPressed) {
return;
}
nextPressed = true;
TLRPC.TL_auth_signUp req = new TLRPC.TL_auth_signUp();
req.phone_code = phoneCode;
req.phone_code_hash = phoneHash;
req.phone_number = requestPhone;
req.first_name = firstNameField.getText().toString();
req.last_name = lastNameField.getText().toString();
if (delegate != null) {
delegate.needShowProgress();
}
ConnectionsManager.getInstance().performRpc(req, new RPCRequest.RPCRequestDelegate() {
@Override
public void run(final TLObject response, final TLRPC.TL_error error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public void run() {
nextPressed = false;
if (delegate != null) {
delegate.needHideProgress();
}
if (error == null) {
final TLRPC.TL_auth_authorization res = (TLRPC.TL_auth_authorization) response;
TLRPC.TL_userSelf user = (TLRPC.TL_userSelf) res.user;
UserConfig.clearConfig();
MessagesController.getInstance().cleanUp();
UserConfig.setCurrentUser(user);
UserConfig.saveConfig(true);
MessagesStorage.getInstance().cleanUp(true);
ArrayList<TLRPC.User> users = new ArrayList<TLRPC.User>();
users.add(user);
MessagesStorage.getInstance().putUsersAndChats(users, null, true, true);
//MessagesController.getInstance().uploadAndApplyUserAvatar(avatarPhotoBig);
MessagesController.getInstance().putUser(res.user, false);
ContactsController.getInstance().checkAppAccount();
MessagesController.getInstance().getBlockedUsers(true);
if (delegate != null) {
delegate.needFinishActivity();
}
ConnectionsManager.getInstance().initPushConnection();
} else {
if (delegate != null) {
if (error.text.contains("PHONE_NUMBER_INVALID")) {
delegate.needShowAlert(LocaleController.getString("InvalidPhoneNumber", R.string.InvalidPhoneNumber));
} else if (error.text.contains("PHONE_CODE_EMPTY") || error.text.contains("PHONE_CODE_INVALID")) {
delegate.needShowAlert(LocaleController.getString("InvalidCode", R.string.InvalidCode));
} else if (error.text.contains("PHONE_CODE_EXPIRED")) {
delegate.needShowAlert(LocaleController.getString("CodeExpired", R.string.CodeExpired));
} else if (error.text.contains("FIRSTNAME_INVALID")) {
delegate.needShowAlert(LocaleController.getString("InvalidFirstName", R.string.InvalidFirstName));
} else if (error.text.contains("LASTNAME_INVALID")) {
delegate.needShowAlert(LocaleController.getString("InvalidLastName", R.string.InvalidLastName));
} else {
delegate.needShowAlert(error.text);
}
}
}
}
});
}
}, true, RPCRequest.RPCRequestClassGeneric | RPCRequest.RPCRequestClassWithoutLogin);
}
@Override
public void saveStateParams(Bundle bundle) {
String first = firstNameField.getText().toString();
if (first != null && first.length() != 0) {
bundle.putString("registerview_first", first);
}
String last = lastNameField.getText().toString();
if (last != null && last.length() != 0) {
bundle.putString("registerview_last", last);
}
if (currentParams != null) {
bundle.putBundle("registerview_params", currentParams);
}
}
@Override
public void restoreStateParams(Bundle bundle) {
currentParams = bundle.getBundle("registerview_params");
if (currentParams != null) {
setParams(currentParams);
}
String first = bundle.getString("registerview_first");
if (first != null) {
firstNameField.setText(first);
}
String last = bundle.getString("registerview_last");
if (last != null) {
lastNameField.setText(last);
}
}
}

View File

@ -1,426 +0,0 @@
/*
* This is the source code of Telegram for Android v. 1.3.2.
* It is licensed under GNU GPL v. 2 or later.
* You should have received a copy of the license in this archive (see LICENSE).
*
* Copyright Nikolai Kudashov, 2013.
*/
package org.telegram.ui;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.os.Build;
import android.os.Bundle;
import android.text.Html;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.widget.EditText;
import android.widget.TextView;
import org.telegram.android.AndroidUtilities;
import org.telegram.PhoneFormat.PhoneFormat;
import org.telegram.android.LocaleController;
import org.telegram.messenger.TLObject;
import org.telegram.messenger.TLRPC;
import org.telegram.messenger.ConnectionsManager;
import org.telegram.android.ContactsController;
import org.telegram.messenger.FileLog;
import org.telegram.android.MessagesController;
import org.telegram.android.MessagesStorage;
import org.telegram.android.NotificationCenter;
import org.telegram.messenger.R;
import org.telegram.messenger.RPCRequest;
import org.telegram.messenger.UserConfig;
import org.telegram.ui.Views.SlideView;
import java.util.ArrayList;
import java.util.Locale;
import java.util.Timer;
import java.util.TimerTask;
public class LoginActivitySmsView extends SlideView implements NotificationCenter.NotificationCenterDelegate {
private String phoneHash;
private String requestPhone;
private String registered;
private EditText codeField;
private TextView confirmTextView;
private TextView timeText;
private TextView problemText;
private Bundle currentParams;
private Timer timeTimer;
private Timer codeTimer;
private static final Object timerSync = new Object();
private volatile int time = 60000;
private volatile int codeTime = 15000;
private double lastCurrentTime;
private double lastCodeTime;
private boolean waitingForSms = false;
private boolean nextPressed = false;
private String lastError = "";
public LoginActivitySmsView(Context context) {
super(context);
}
public LoginActivitySmsView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public LoginActivitySmsView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@Override
protected void onFinishInflate() {
super.onFinishInflate();
confirmTextView = (TextView)findViewById(R.id.login_sms_confirm_text);
codeField = (EditText)findViewById(R.id.login_sms_code_field);
codeField.setHint(LocaleController.getString("Code", R.string.Code));
timeText = (TextView)findViewById(R.id.login_time_text);
problemText = (TextView)findViewById(R.id.login_problem);
TextView wrongNumber = (TextView) findViewById(R.id.wrong_number);
wrongNumber.setText(LocaleController.getString("WrongNumber", R.string.WrongNumber));
problemText.setText(LocaleController.getString("DidNotGetTheCode", R.string.DidNotGetTheCode));
problemText.setVisibility(time < 1000 ? VISIBLE : GONE);
wrongNumber.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
onBackPressed();
delegate.setPage(0, true, null, true);
}
});
problemText.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
try {
PackageInfo pInfo = ApplicationLoader.applicationContext.getPackageManager().getPackageInfo(ApplicationLoader.applicationContext.getPackageName(), 0);
String version = String.format(Locale.US, "%s (%d)", pInfo.versionName, pInfo.versionCode);
Intent mailer = new Intent(Intent.ACTION_SEND);
mailer.setType("message/rfc822");
mailer.putExtra(Intent.EXTRA_EMAIL, new String[]{"sms@telegram.org"});
mailer.putExtra(Intent.EXTRA_SUBJECT, "Android registration/login issue " + version + " " + requestPhone);
mailer.putExtra(Intent.EXTRA_TEXT, "Phone: " + requestPhone + "\nApp version: " + version + "\nOS version: SDK " + Build.VERSION.SDK_INT + "\nDevice Name: " + Build.MANUFACTURER + Build.MODEL + "\nLocale: " + Locale.getDefault() + "\nError: " + lastError);
getContext().startActivity(Intent.createChooser(mailer, "Send email..."));
} catch (Exception e) {
if (delegate != null) {
delegate.needShowAlert(LocaleController.getString("NoMailInstalled", R.string.NoMailInstalled));
}
}
}
});
codeField.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
if (i == EditorInfo.IME_ACTION_NEXT) {
if (delegate != null) {
delegate.onNextAction();
}
return true;
}
return false;
}
});
}
@Override
public String getHeaderName() {
return LocaleController.getString("YourCode", R.string.YourCode);
}
@Override
public void setParams(Bundle params) {
if (params == null) {
return;
}
codeField.setText("");
AndroidUtilities.setWaitingForSms(true);
NotificationCenter.getInstance().addObserver(this, NotificationCenter.didReceiveSmsCode);
currentParams = params;
waitingForSms = true;
String phone = params.getString("phone");
requestPhone = params.getString("phoneFormated");
phoneHash = params.getString("phoneHash");
registered = params.getString("registered");
time = params.getInt("calltime");
if (phone == null) {
return;
}
String number = PhoneFormat.getInstance().format(phone);
confirmTextView.setText(Html.fromHtml(String.format(LocaleController.getString("SentSmsCode", R.string.SentSmsCode) + " <b>%s</b>", number)));
AndroidUtilities.showKeyboard(codeField);
codeField.requestFocus();
destroyTimer();
destroyCodeTimer();
timeText.setText(LocaleController.formatString("CallText", R.string.CallText, 1, 0));
lastCurrentTime = System.currentTimeMillis();
problemText.setVisibility(time < 1000 ? VISIBLE : GONE);
createTimer();
}
private void createCodeTimer() {
if (codeTimer != null) {
return;
}
codeTime = 15000;
codeTimer = new Timer();
lastCodeTime = System.currentTimeMillis();
codeTimer.schedule(new TimerTask() {
@Override
public void run() {
double currentTime = System.currentTimeMillis();
double diff = currentTime - lastCodeTime;
codeTime -= diff;
lastCodeTime = currentTime;
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public void run() {
if (codeTime <= 1000) {
problemText.setVisibility(VISIBLE);
destroyCodeTimer();
}
}
});
}
}, 0, 1000);
}
private void destroyCodeTimer() {
try {
synchronized(timerSync) {
if (codeTimer != null) {
codeTimer.cancel();
codeTimer = null;
}
}
} catch (Exception e) {
FileLog.e("tmessages", e);
}
}
private void createTimer() {
if (timeTimer != null) {
return;
}
timeTimer = new Timer();
timeTimer.schedule(new TimerTask() {
@Override
public void run() {
double currentTime = System.currentTimeMillis();
double diff = currentTime - lastCurrentTime;
time -= diff;
lastCurrentTime = currentTime;
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public void run() {
if (time >= 1000) {
int minutes = time / 1000 / 60;
int seconds = time / 1000 - minutes * 60;
timeText.setText(LocaleController.formatString("CallText", R.string.CallText, minutes, seconds));
} else {
timeText.setText(LocaleController.getString("Calling", R.string.Calling));
destroyTimer();
createCodeTimer();
TLRPC.TL_auth_sendCall req = new TLRPC.TL_auth_sendCall();
req.phone_number = requestPhone;
req.phone_code_hash = phoneHash;
ConnectionsManager.getInstance().performRpc(req, new RPCRequest.RPCRequestDelegate() {
@Override
public void run(TLObject response, final TLRPC.TL_error error) {
if (error != null && error.text != null) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public void run() {
lastError = error.text;
}
});
}
}
}, true, RPCRequest.RPCRequestClassGeneric | RPCRequest.RPCRequestClassFailOnServerErrors | RPCRequest.RPCRequestClassWithoutLogin);
}
}
});
}
}, 0, 1000);
}
private void destroyTimer() {
try {
synchronized(timerSync) {
if (timeTimer != null) {
timeTimer.cancel();
timeTimer = null;
}
}
} catch (Exception e) {
FileLog.e("tmessages", e);
}
}
@Override
public void onNextPressed() {
if (nextPressed) {
return;
}
nextPressed = true;
waitingForSms = false;
AndroidUtilities.setWaitingForSms(false);
NotificationCenter.getInstance().removeObserver(this, NotificationCenter.didReceiveSmsCode);
final TLRPC.TL_auth_signIn req = new TLRPC.TL_auth_signIn();
req.phone_number = requestPhone;
req.phone_code = codeField.getText().toString();
req.phone_code_hash = phoneHash;
destroyTimer();
if (delegate != null) {
delegate.needShowProgress();
}
ConnectionsManager.getInstance().performRpc(req, new RPCRequest.RPCRequestDelegate() {
@Override
public void run(final TLObject response, final TLRPC.TL_error error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public void run() {
if (delegate == null) {
return;
}
delegate.needHideProgress();
nextPressed = false;
if (error == null) {
TLRPC.TL_auth_authorization res = (TLRPC.TL_auth_authorization)response;
destroyTimer();
destroyCodeTimer();
UserConfig.clearConfig();
MessagesController.getInstance().cleanUp();
UserConfig.setCurrentUser(res.user);
UserConfig.saveConfig(true);
MessagesStorage.getInstance().cleanUp(true);
ArrayList<TLRPC.User> users = new ArrayList<TLRPC.User>();
users.add(res.user);
MessagesStorage.getInstance().putUsersAndChats(users, null, true, true);
MessagesController.getInstance().putUser(res.user, false);
ContactsController.getInstance().checkAppAccount();
MessagesController.getInstance().getBlockedUsers(true);
delegate.needFinishActivity();
ConnectionsManager.getInstance().initPushConnection();
} else {
lastError = error.text;
if (error.text.contains("PHONE_NUMBER_UNOCCUPIED") && registered == null) {
Bundle params = new Bundle();
params.putString("phoneFormated", requestPhone);
params.putString("phoneHash", phoneHash);
params.putString("code", req.phone_code);
delegate.setPage(2, true, params, false);
destroyTimer();
destroyCodeTimer();
} else {
createTimer();
if (error.text.contains("PHONE_NUMBER_INVALID")) {
delegate.needShowAlert(LocaleController.getString("InvalidPhoneNumber", R.string.InvalidPhoneNumber));
} else if (error.text.contains("PHONE_CODE_EMPTY") || error.text.contains("PHONE_CODE_INVALID")) {
delegate.needShowAlert(LocaleController.getString("InvalidCode", R.string.InvalidCode));
} else if (error.text.contains("PHONE_CODE_EXPIRED")) {
delegate.needShowAlert(LocaleController.getString("CodeExpired", R.string.CodeExpired));
} else if (error.text.startsWith("FLOOD_WAIT")) {
delegate.needShowAlert(LocaleController.getString("FloodWait", R.string.FloodWait));
} else {
delegate.needShowAlert(error.text);
}
}
}
}
});
}
}, true, RPCRequest.RPCRequestClassGeneric | RPCRequest.RPCRequestClassFailOnServerErrors | RPCRequest.RPCRequestClassWithoutLogin);
}
@Override
public void onBackPressed() {
destroyTimer();
destroyCodeTimer();
currentParams = null;
AndroidUtilities.setWaitingForSms(false);
NotificationCenter.getInstance().removeObserver(this, NotificationCenter.didReceiveSmsCode);
waitingForSms = false;
}
@Override
public void onDestroyActivity() {
super.onDestroyActivity();
AndroidUtilities.setWaitingForSms(false);
NotificationCenter.getInstance().removeObserver(this, NotificationCenter.didReceiveSmsCode);
destroyTimer();
destroyCodeTimer();
waitingForSms = false;
}
@Override
public void onShow() {
super.onShow();
if (codeField != null) {
codeField.requestFocus();
codeField.setSelection(codeField.length());
}
}
@Override
public void didReceivedNotification(int id, final Object... args) {
if (id == NotificationCenter.didReceiveSmsCode) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public void run() {
if (!waitingForSms) {
return;
}
if (codeField != null) {
codeField.setText("" + args[0]);
onNextPressed();
}
}
});
}
}
@Override
public void saveStateParams(Bundle bundle) {
String code = codeField.getText().toString();
if (code != null && code.length() != 0) {
bundle.putString("smsview_code", code);
}
if (currentParams != null) {
bundle.putBundle("smsview_params", currentParams);
}
if (time != 0) {
bundle.putInt("time", time);
}
}
@Override
public void restoreStateParams(Bundle bundle) {
currentParams = bundle.getBundle("smsview_params");
if (currentParams != null) {
setParams(currentParams);
}
String code = bundle.getString("smsview_code");
if (code != null) {
codeField.setText(code);
}
Integer t = bundle.getInt("time");
if (t != 0) {
time = t;
}
}
}

View File

@ -149,9 +149,16 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
searching = false;
searchWas = false;
if (messagesListView != null) {
messagesListView.setEmptyView(emptyView);
searchEmptyView.setVisibility(View.GONE);
progressView.setVisibility(View.GONE);
if (MessagesController.getInstance().loadingDialogs && MessagesController.getInstance().dialogs.isEmpty()) {
searchEmptyView.setVisibility(View.GONE);
emptyView.setVisibility(View.GONE);
progressView.setVisibility(View.VISIBLE);
messagesListView.setEmptyView(progressView);
} else {
messagesListView.setEmptyView(emptyView);
searchEmptyView.setVisibility(View.GONE);
progressView.setVisibility(View.GONE);
}
if (!onlySelect) {
floatingButton.setVisibility(View.VISIBLE);
floatingHidden = true;
@ -274,15 +281,11 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
if (MessagesController.getInstance().loadingDialogs && MessagesController.getInstance().dialogs.isEmpty()) {
searchEmptyView.setVisibility(View.GONE);
emptyView.setVisibility(View.GONE);
progressView.setVisibility(View.VISIBLE);
messagesListView.setEmptyView(progressView);
} else {
if (searching && searchWas) {
messagesListView.setEmptyView(searchEmptyView);
emptyView.setVisibility(View.GONE);
} else {
messagesListView.setEmptyView(emptyView);
searchEmptyView.setVisibility(View.GONE);
}
messagesListView.setEmptyView(emptyView);
searchEmptyView.setVisibility(View.GONE);
progressView.setVisibility(View.GONE);
}

View File

@ -353,7 +353,7 @@ public class PhotoCropActivity extends BaseFragment {
});
ActionBarMenu menu = actionBar.createMenu();
menu.addItem(done_button, R.drawable.ic_done);
menu.addItem(done_button, R.drawable.ic_done, 0, AndroidUtilities.dp(56));
fragmentView = view = new PhotoCropView(getParentActivity());
fragmentView.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT));

View File

@ -0,0 +1,14 @@
/*
* This is the source code of Telegram for Android v. 1.7.x.
* It is licensed under GNU GPL v. 2 or later.
* You should have received a copy of the license in this archive (see LICENSE).
*
* Copyright Nikolai Kudashov, 2013-2014.
*/
package org.telegram.ui;
import org.telegram.ui.ActionBar.BaseFragment;
public class PrivacySettingsActivity extends BaseFragment {
}

View File

@ -254,10 +254,7 @@ public class VideoEditorActivity extends BaseFragment implements TextureView.Sur
});
ActionBarMenu menu = actionBar.createMenu();
View doneItem = menu.addItemResource(1, R.layout.group_create_done_layout);
TextView doneTextView = (TextView) doneItem.findViewById(R.id.done_button);
doneTextView.setText(LocaleController.getString("Done", R.string.Done).toUpperCase());
menu.addItem(1, R.drawable.ic_done, 0, AndroidUtilities.dp(56));
fragmentView = inflater.inflate(R.layout.video_editor_layout, container, false);
originalSizeTextView = (TextView) fragmentView.findViewById(R.id.original_size);

View File

@ -35,6 +35,7 @@ public class AvatarDrawable extends Drawable {
R.drawable.bar_selector_green, R.drawable.bar_selector_cyan, R.drawable.bar_selector_blue, R.drawable.bar_selector_violet, R.drawable.bar_selector_pink};
private static Drawable broadcastDrawable;
private static Drawable photoDrawable;
private int color;
private StaticLayout textLayout;
@ -42,6 +43,7 @@ public class AvatarDrawable extends Drawable {
private float textHeight;
private boolean isProfile;
private boolean drawBrodcast;
private boolean drawPhoto;
public AvatarDrawable() {
super();
@ -147,6 +149,13 @@ public class AvatarDrawable extends Drawable {
}
}
public void setDrawPhoto(boolean value) {
if (value && photoDrawable == null) {
photoDrawable = ApplicationLoader.applicationContext.getResources().getDrawable(R.drawable.photo_w);
}
drawPhoto = value;
}
@Override
public void draw(Canvas canvas) {
Rect bounds = getBounds();
@ -168,6 +177,11 @@ public class AvatarDrawable extends Drawable {
if (textLayout != null) {
canvas.translate((size - textWidth) / 2, (size - textHeight) / 2);
textLayout.draw(canvas);
} else if (drawPhoto && photoDrawable != null) {
int x = (size - photoDrawable.getIntrinsicWidth()) / 2;
int y = (size - photoDrawable.getIntrinsicHeight()) / 2;
photoDrawable.setBounds(x, y, x + photoDrawable.getIntrinsicWidth(), y + photoDrawable.getIntrinsicHeight());
photoDrawable.draw(canvas);
}
}
canvas.restore();

View File

@ -26,6 +26,7 @@ import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.Surface;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.inputmethod.EditorInfo;
@ -49,6 +50,8 @@ import org.telegram.messenger.R;
import org.telegram.messenger.TLRPC;
import org.telegram.ui.ApplicationLoader;
import java.util.ArrayList;
public class ChatActivityEnterView implements NotificationCenter.NotificationCenterDelegate, SizeNotifierRelativeLayout.SizeNotifierRelativeLayoutDelegate {
public static interface ChatActivityEnterViewDelegate {
@ -65,24 +68,25 @@ public class ChatActivityEnterView implements NotificationCenter.NotificationCen
private ImageButton audioSendButton;
private View recordPanel;
private View slideText;
private PowerManager.WakeLock mWakeLock = null;
private PowerManager.WakeLock mWakeLock;
private SizeNotifierRelativeLayout sizeNotifierRelativeLayout;
private Object runningAnimation = null;
private int runningAnimationType = 0;
private FrameLayout attachButton;
private Object runningAnimation;
private int runningAnimationType;
private int keyboardHeight = 0;
private int keyboardHeightLand = 0;
private int keyboardHeight;
private int keyboardHeightLand;
private boolean keyboardVisible;
private boolean sendByEnter = false;
private long lastTypingTimeSend = 0;
private String lastTimeString = null;
private boolean sendByEnter;
private long lastTypingTimeSend;
private String lastTimeString;
private float startedDraggingX = -1;
private float distCanMove = AndroidUtilities.dp(80);
private boolean recordingAudio = false;
private boolean recordingAudio;
private Activity parentActivity;
private long dialog_id;
private boolean ignoreTextChange = false;
private boolean ignoreTextChange;
private ChatActivityEnterViewDelegate delegate;
public ChatActivityEnterView() {
@ -123,20 +127,22 @@ public class ChatActivityEnterView implements NotificationCenter.NotificationCen
public void setContainerView(Activity activity, View containerView) {
parentActivity = activity;
sizeNotifierRelativeLayout = (SizeNotifierRelativeLayout)containerView.findViewById(R.id.chat_layout);
sizeNotifierRelativeLayout = (SizeNotifierRelativeLayout) containerView.findViewById(R.id.chat_layout);
sizeNotifierRelativeLayout.delegate = this;
messsageEditText = (EditText)containerView.findViewById(R.id.chat_text_edit);
messsageEditText = (EditText) containerView.findViewById(R.id.chat_text_edit);
messsageEditText.setHint(LocaleController.getString("TypeMessage", R.string.TypeMessage));
sendButton = (ImageButton)containerView.findViewById(R.id.chat_send_button);
attachButton = (FrameLayout) containerView.findViewById(R.id.chat_attach_button);
sendButton = (ImageButton) containerView.findViewById(R.id.chat_send_button);
sendButton.setVisibility(View.INVISIBLE);
emojiButton = (ImageView)containerView.findViewById(R.id.chat_smile_button);
audioSendButton = (ImageButton)containerView.findViewById(R.id.chat_audio_send_button);
emojiButton = (ImageView) containerView.findViewById(R.id.chat_smile_button);
audioSendButton = (ImageButton) containerView.findViewById(R.id.chat_audio_send_button);
recordPanel = containerView.findViewById(R.id.record_panel);
recordTimeText = (TextView)containerView.findViewById(R.id.recording_time_text);
recordTimeText = (TextView) containerView.findViewById(R.id.recording_time_text);
slideText = containerView.findViewById(R.id.slideText);
TextView textView = (TextView)containerView.findViewById(R.id.slideToCancelTextView);
TextView textView = (TextView) containerView.findViewById(R.id.slideToCancelTextView);
textView.setText(LocaleController.getString("SlideToCancel", R.string.SlideToCancel));
emojiButton.setOnClickListener(new View.OnClickListener() {
@ -218,12 +224,12 @@ public class ChatActivityEnterView implements NotificationCenter.NotificationCen
recordingAudio = false;
updateAudioRecordIntefrace();
}
if(android.os.Build.VERSION.SDK_INT > 13) {
if (android.os.Build.VERSION.SDK_INT > 13) {
x = x + audioSendButton.getX();
FrameLayout.LayoutParams params = (FrameLayout.LayoutParams)slideText.getLayoutParams();
FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) slideText.getLayoutParams();
if (startedDraggingX != -1) {
float dist = (x - startedDraggingX);
params.leftMargin = AndroidUtilities.dp(30) + (int)dist;
params.leftMargin = AndroidUtilities.dp(30) + (int) dist;
slideText.setLayoutParams(params);
float alpha = 1.0f + dist / distCanMove;
if (alpha > 1) {
@ -271,8 +277,8 @@ public class ChatActivityEnterView implements NotificationCenter.NotificationCen
if (message.length() != 0 && lastTypingTimeSend < System.currentTimeMillis() - 5000 && !ignoreTextChange) {
int currentTime = ConnectionsManager.getInstance().getCurrentTime();
TLRPC.User currentUser = null;
if ((int)dialog_id > 0) {
currentUser = MessagesController.getInstance().getUser((int)dialog_id);
if ((int) dialog_id > 0) {
currentUser = MessagesController.getInstance().getUser((int) dialog_id);
}
if (currentUser != null && currentUser.status != null && currentUser.status.expires < currentTime) {
return;
@ -319,7 +325,7 @@ public class ChatActivityEnterView implements NotificationCenter.NotificationCen
public boolean processSendingText(String text) {
text = getTrimmedString(text);
if (text.length() != 0) {
int count = (int)Math.ceil(text.length() / 4096.0f);
int count = (int) Math.ceil(text.length() / 4096.0f);
for (int a = 0; a < count; a++) {
String mess = text.substring(a * 4096, Math.min((a + 1) * 4096, text.length()));
SendMessagesHelper.getInstance().sendMessage(mess, dialog_id);
@ -352,7 +358,7 @@ public class ChatActivityEnterView implements NotificationCenter.NotificationCen
return;
}
if (runningAnimation != null) {
((AnimatorSet)runningAnimation).cancel();
((AnimatorSet) runningAnimation).cancel();
runningAnimation = null;
}
@ -360,14 +366,23 @@ public class ChatActivityEnterView implements NotificationCenter.NotificationCen
AnimatorSet animatorSet = new AnimatorSet();
runningAnimation = animatorSet;
runningAnimationType = 1;
animatorSet.playTogether(
ObjectAnimator.ofFloat(audioSendButton, "scaleX", 0.1f),
ObjectAnimator.ofFloat(audioSendButton, "scaleY", 0.1f),
ObjectAnimator.ofFloat(audioSendButton, "alpha", 0.0f),
ObjectAnimator.ofFloat(sendButton, "scaleX", 1.0f),
ObjectAnimator.ofFloat(sendButton, "scaleY", 1.0f),
ObjectAnimator.ofFloat(sendButton, "alpha", 1.0f)
);
ArrayList<Animator> animators = new ArrayList<Animator>();
animators.add(ObjectAnimator.ofFloat(audioSendButton, "scaleX", 0.1f));
animators.add(ObjectAnimator.ofFloat(audioSendButton, "scaleY", 0.1f));
animators.add(ObjectAnimator.ofFloat(audioSendButton, "alpha", 0.0f));
animators.add(ObjectAnimator.ofFloat(sendButton, "scaleX", 1.0f));
animators.add(ObjectAnimator.ofFloat(sendButton, "scaleY", 1.0f));
animators.add(ObjectAnimator.ofFloat(sendButton, "alpha", 1.0f));
if (attachButton != null) {
animators.add(ObjectAnimator.ofFloat(attachButton, "alpha", 0.0f));
animators.add(ObjectAnimator.ofFloat(attachButton, "translationX", AndroidUtilities.dp(48)));
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) messsageEditText.getLayoutParams();
layoutParams.rightMargin = AndroidUtilities.dp(6);
messsageEditText.setLayoutParams(layoutParams);
}
animatorSet.playTogether(animators);
animatorSet.setDuration(200);
animatorSet.addListener(new AnimatorListenerAdapter() {
@ -393,6 +408,9 @@ public class ChatActivityEnterView implements NotificationCenter.NotificationCen
}
sendButton.setVisibility(View.VISIBLE);
audioSendButton.setVisibility(View.INVISIBLE);
if (attachButton != null) {
attachButton.setVisibility(View.GONE);
}
}
}
} else if (sendButton.getVisibility() == View.VISIBLE) {
@ -402,7 +420,7 @@ public class ChatActivityEnterView implements NotificationCenter.NotificationCen
}
if (runningAnimation != null) {
((AnimatorSet)runningAnimation).cancel();
((AnimatorSet) runningAnimation).cancel();
runningAnimation = null;
}
@ -410,14 +428,23 @@ public class ChatActivityEnterView implements NotificationCenter.NotificationCen
AnimatorSet animatorSet = new AnimatorSet();
runningAnimation = animatorSet;
runningAnimationType = 2;
animatorSet.playTogether(
ObjectAnimator.ofFloat(sendButton, "scaleX", 0.1f),
ObjectAnimator.ofFloat(sendButton, "scaleY", 0.1f),
ObjectAnimator.ofFloat(sendButton, "alpha", 0.0f),
ObjectAnimator.ofFloat(audioSendButton, "scaleX", 1.0f),
ObjectAnimator.ofFloat(audioSendButton, "scaleY", 1.0f),
ObjectAnimator.ofFloat(audioSendButton, "alpha", 1.0f)
);
ArrayList<Animator> animators = new ArrayList<Animator>();
animators.add(ObjectAnimator.ofFloat(sendButton, "scaleX", 0.1f));
animators.add(ObjectAnimator.ofFloat(sendButton, "scaleY", 0.1f));
animators.add(ObjectAnimator.ofFloat(sendButton, "alpha", 0.0f));
animators.add(ObjectAnimator.ofFloat(audioSendButton, "scaleX", 1.0f));
animators.add(ObjectAnimator.ofFloat(audioSendButton, "scaleY", 1.0f));
animators.add(ObjectAnimator.ofFloat(audioSendButton, "alpha", 1.0f));
if (attachButton != null) {
animators.add(ObjectAnimator.ofFloat(attachButton, "alpha", 1.0f));
animators.add(ObjectAnimator.ofFloat(attachButton, "translationX", 0.0f));
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) messsageEditText.getLayoutParams();
layoutParams.rightMargin = AndroidUtilities.dp(54);
messsageEditText.setLayoutParams(layoutParams);
}
animatorSet.playTogether(animators);
animatorSet.setDuration(200);
animatorSet.addListener(new AnimatorListenerAdapter() {
@ -443,6 +470,9 @@ public class ChatActivityEnterView implements NotificationCenter.NotificationCen
}
sendButton.setVisibility(View.INVISIBLE);
audioSendButton.setVisibility(View.VISIBLE);
if (attachButton != null) {
attachButton.setVisibility(View.VISIBLE);
}
}
}
}
@ -463,8 +493,8 @@ public class ChatActivityEnterView implements NotificationCenter.NotificationCen
recordPanel.setVisibility(View.VISIBLE);
recordTimeText.setText("00:00");
lastTimeString = null;
if(android.os.Build.VERSION.SDK_INT > 13) {
FrameLayout.LayoutParams params = (FrameLayout.LayoutParams)slideText.getLayoutParams();
if (android.os.Build.VERSION.SDK_INT > 13) {
FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) slideText.getLayoutParams();
params.leftMargin = AndroidUtilities.dp(30);
slideText.setLayoutParams(params);
slideText.setAlpha(1);
@ -498,7 +528,7 @@ public class ChatActivityEnterView implements NotificationCenter.NotificationCen
}
}
AndroidUtilities.unlockOrientation(parentActivity);
if(android.os.Build.VERSION.SDK_INT > 13) {
if (android.os.Build.VERSION.SDK_INT > 13) {
recordPanel.animate().setInterpolator(new AccelerateDecelerateInterpolator()).setListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animator) {
@ -507,7 +537,7 @@ public class ChatActivityEnterView implements NotificationCenter.NotificationCen
@Override
public void onAnimationEnd(Animator animator) {
FrameLayout.LayoutParams params = (FrameLayout.LayoutParams)slideText.getLayoutParams();
FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) slideText.getLayoutParams();
params.leftMargin = AndroidUtilities.dp(30);
slideText.setLayoutParams(params);
slideText.setAlpha(1);
@ -670,6 +700,22 @@ public class ChatActivityEnterView implements NotificationCenter.NotificationCen
return emojiPopup != null && emojiPopup.isShowing();
}
public void addToAttachLayout(View view) {
if (attachButton == null) {
return;
}
if (view.getParent() != null) {
ViewGroup viewGroup = (ViewGroup) view.getParent();
viewGroup.removeView(view);
}
attachButton.addView(view);
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) view.getLayoutParams();
layoutParams.gravity = Gravity.CENTER;
layoutParams.width = FrameLayout.LayoutParams.WRAP_CONTENT;
layoutParams.height = FrameLayout.LayoutParams.WRAP_CONTENT;
view.setLayoutParams(layoutParams);
}
@Override
public void onSizeChanged(int height) {
Rect localRect = new Rect();
@ -698,7 +744,7 @@ public class ChatActivityEnterView implements NotificationCenter.NotificationCen
} else {
newHeight = keyboardHeight;
}
final WindowManager.LayoutParams layoutParams = (WindowManager.LayoutParams)emojiPopup.getContentView().getLayoutParams();
final WindowManager.LayoutParams layoutParams = (WindowManager.LayoutParams) emojiPopup.getContentView().getLayoutParams();
if (layoutParams.width != AndroidUtilities.displaySize.x || layoutParams.height != newHeight) {
WindowManager wm = (WindowManager) ApplicationLoader.applicationContext.getSystemService(Context.WINDOW_SERVICE);
layoutParams.width = AndroidUtilities.displaySize.x;
@ -734,7 +780,7 @@ public class ChatActivityEnterView implements NotificationCenter.NotificationCen
emojiView.invalidateViews();
}
} else if (id == NotificationCenter.recordProgressChanged) {
Long time = (Long)args[0] / 1000;
Long time = (Long) args[0] / 1000;
String str = String.format("%02d:%02d", time / 60, time % 60);
if (lastTimeString == null || !lastTimeString.equals(str)) {
if (recordTimeText != null) {

View File

@ -0,0 +1,58 @@
/*
* This is the source code of Telegram for Android v. 1.7.x.
* It is licensed under GNU GPL v. 2 or later.
* You should have received a copy of the license in this archive (see LICENSE).
*
* Copyright Nikolai Kudashov, 2013-2014.
*/
package org.telegram.ui.Views;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.drawable.Drawable;
import android.widget.CompoundButton;
import org.telegram.messenger.R;
public class CheckBox extends CompoundButton {
private Paint paint;
private Drawable checkDrawable;
public CheckBox(Context context) {
super(context);
paint = new Paint(Paint.ANTI_ALIAS_FLAG);
paint.setColor(0xff5ec245);
checkDrawable = context.getResources().getDrawable(R.drawable.round_check2);
}
@Override
public void setChecked(boolean checked) {
super.setChecked(checked);
checked = isChecked();
invalidate();
/*if (attachedToWindow && wasLayout) {
animateThumbToCheckedState(checked);
} else {
cancelPositionAnimator();
setThumbPosition(checked ? 1 : 0);
}*/
}
@Override
protected void onDraw(Canvas canvas) {
if (isChecked()) {
canvas.drawCircle(getMeasuredWidth() / 2, getMeasuredHeight() / 2, getMeasuredWidth() / 2, paint);
int x = (getMeasuredWidth() - checkDrawable.getIntrinsicWidth()) / 2;
int y = (getMeasuredHeight() - checkDrawable.getIntrinsicHeight()) / 2;
checkDrawable.setBounds(x, y, x + checkDrawable.getIntrinsicWidth(), y + checkDrawable.getIntrinsicHeight());
checkDrawable.draw(canvas);
}
}
}

View File

@ -1,71 +0,0 @@
/*
* This is the source code of Telegram for Android v. 1.3.2.
* It is licensed under GNU GPL v. 2 or later.
* You should have received a copy of the license in this archive (see LICENSE).
*
* Copyright Nikolai Kudashov, 2013.
*/
package org.telegram.ui.Views;
import android.content.Context;
import android.os.Bundle;
import android.util.AttributeSet;
import android.widget.LinearLayout;
public class SlideView extends LinearLayout {
public static interface SlideViewDelegate {
public abstract void onNextAction();
public abstract void needShowAlert(String text);
public abstract void needShowProgress();
public abstract void needHideProgress();
public abstract void setPage(int page, boolean animated, Bundle params, boolean back);
public abstract void needFinishActivity();
}
public SlideView(Context context) {
super(context);
}
public SlideView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public SlideView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
public SlideViewDelegate delegate;
public String getHeaderName() {
return "";
}
public void onNextPressed() {
}
public void setParams(Bundle params) {
}
public void onBackPressed() {
}
public void onShow() {
}
public void onDestroyActivity() {
delegate = null;
}
public void saveStateParams(Bundle bundle) {
}
public void restoreStateParams(Bundle bundle) {
}
}

View File

@ -155,7 +155,7 @@ public class WallpapersActivity extends BaseFragment implements NotificationCent
});
ActionBarMenu menu = actionBar.createMenu();
doneButton = menu.addItem(done_button, R.drawable.ic_done);
doneButton = menu.addItem(done_button, R.drawable.ic_done, 0, AndroidUtilities.dp(56));
fragmentView = inflater.inflate(R.layout.settings_wallpapers_layout, container, false);
listAdapter = new ListAdapter(getParentActivity());

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 131 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 339 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 328 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 131 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 269 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 276 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 134 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 389 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 370 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 144 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 473 B

View File

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_window_focused="false" android:state_enabled="true" android:drawable="@drawable/search_dark_activated" />
<item android:state_enabled="true" android:state_focused="true" android:drawable="@drawable/search_dark_activated" />
<item android:state_focused="true" android:drawable="@drawable/search_dark_activated" />
<item android:drawable="@drawable/search_dark" />

View File

@ -1,7 +1,47 @@
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/spinner_pressed" />
<item android:state_focused="true" android:drawable="@drawable/spinner_pressed" />
<item android:state_checked="true" android:drawable="@drawable/spinner_pressed" />
<item android:drawable="@drawable/spinner" />
<item android:state_pressed="true">
<shape android:shape="rectangle">
<padding
android:left="4dp"
android:top="4dp"
android:right="4dp"
android:bottom="4dp"/>
<solid
android:color="#22000000" />
</shape>
</item>
<item android:state_checked="true">
<shape android:shape="rectangle">
<padding
android:left="4dp"
android:top="4dp"
android:right="4dp"
android:bottom="4dp"/>
<solid
android:color="#22000000" />
</shape>
</item>
<item android:state_focused="true">
<shape android:shape="rectangle">
<padding
android:left="4dp"
android:top="4dp"
android:right="4dp"
android:bottom="4dp"/>
<solid
android:color="#22000000" />
</shape>
</item>
<item>
<shape android:shape="rectangle">
<padding
android:left="4dp"
android:top="4dp"
android:right="4dp"
android:bottom="4dp"/>
<solid
android:color="#00000000" />
</shape>
</item>
</selector>

View File

@ -1,36 +0,0 @@
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:layout_gravity="top">
<TextView
android:textSize="18dp"
android:textColor="#999999"
android:id="@+id/settings_row_text_detail"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_marginLeft="12dp"
android:layout_marginRight="8dp"
android:gravity="center_vertical|left"
android:layout_gravity="left"/>
<TextView
android:textSize="18dp"
android:textColor="#333333"
android:id="@+id/settings_row_text"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_marginLeft="8dp"
android:layout_marginRight="12dp"
android:gravity="center_vertical|right"
android:layout_gravity="top|right"/>
<View
android:background="@color/divider"
android:layout_width="fill_parent"
android:layout_height="1px"
android:layout_gravity="bottom"
android:id="@+id/settings_row_divider"/>
</FrameLayout>

View File

@ -1,69 +0,0 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/top_layout"
android:layout_gravity="top">
<FrameLayout
android:layout_width="64dp"
android:layout_height="64dp"
android:layout_marginTop="12dp"
android:layout_marginBottom="12dp"
android:layout_marginRight="16dp"
android:layout_gravity="top|right">
<org.telegram.ui.Views.BackupImageView
android:id="@+id/settings_avatar_image"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
</FrameLayout>
<EditText
android:textSize="18dp"
android:textColorHint="#a6a6a6"
android:id="@+id/bubble_input_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="96dp"
android:minHeight="52dp"
android:maxLines="4"
android:paddingTop="0dp"
android:layout_marginTop="0dp"
android:gravity="right|center_vertical"
android:imeOptions="flagNoExtractUi"
android:inputType="textCapSentences"
android:layout_gravity="center_vertical|right"
android:textCursorDrawable="@null"
android:textColor="#000000"/>
</FrameLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<org.telegram.ui.Views.PinnedHeaderListView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/listView"
android:clipToPadding="false"
android:fadingEdge="none"
android:fadingEdgeLength="0dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:dividerHeight="0dp"
android:divider="@null"
android:paddingBottom="16dp"
android:scrollbars="none"/>
</FrameLayout>
</LinearLayout>

View File

@ -103,137 +103,155 @@
</FrameLayout>
<RelativeLayout
android:layout_width="match_parent"
<LinearLayout
android:layout_height="wrap_content"
android:background="@drawable/compose_panel"
android:id="@+id/chat_compose_panel"
android:layout_width="match_parent"
android:layout_alignParentBottom="true"
android:focusable="true"
android:focusableInTouchMode="true"
android:gravity="bottom"
android:layout_alignParentBottom="true">
android:id="@+id/chat_compose_panel"
android:background="@drawable/compose_panel"
android:orientation="horizontal">
<ImageView
android:src="@drawable/ic_msg_panel_smiles"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginTop="2dp"
android:paddingTop="1dp"
android:scaleType="centerInside"
android:paddingLeft="4dp"
android:id="@+id/chat_smile_button"
android:layout_alignBottom="@+id/chat_text_edit"/>
<ImageButton
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginTop="2dp"
android:scaleType="centerInside"
android:id="@+id/chat_send_button"
android:layout_alignParentRight="true"
android:layout_alignBottom="@+id/chat_text_edit"
android:enabled="false"
android:src="@drawable/ic_send"
android:background="@android:color/transparent"/>
<EditText
android:layout_width="match_parent"
<FrameLayout
android:layout_height="wrap_content"
android:id="@+id/chat_text_edit"
android:layout_toRightOf="@id/chat_smile_button"
android:layout_toLeftOf="@id/chat_send_button"
android:layout_marginTop="2dp"
android:maxLines="4"
android:minHeight="48dp"
android:textSize="18dp"
android:textColorHint="#909090"
android:ems="10"
android:imeOptions="flagNoExtractUi"
android:inputType="textCapSentences|textMultiLine"
android:layout_alignParentTop="true"
android:paddingBottom="12dp"
android:maxLength="16384"
android:textCursorDrawable="@null"
android:textColor="#000000"/>
android:layout_width="0dp"
android:layout_weight="1">
<org.telegram.ui.Views.FrameLayoutFixed
android:layout_height="48dp"
android:layout_width="fill_parent"
android:layout_marginTop="2dp"
android:layout_marginRight="48dp"
android:background="#ffffff"
android:id="@+id/record_panel"
android:visibility="gone">
<ImageView
android:src="@drawable/ic_msg_panel_smiles"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginTop="2dp"
android:paddingTop="1dp"
android:paddingLeft="4dp"
android:scaleType="centerInside"
android:layout_gravity="bottom"
android:id="@+id/chat_smile_button"/>
<LinearLayout
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="30dp"
android:orientation="horizontal"
android:id="@+id/slideText">
android:layout_gravity="bottom"
android:id="@+id/chat_text_edit"
android:layout_marginTop="2dp"
android:maxLines="4"
android:textSize="18dp"
android:textColorHint="#909090"
android:ems="10"
android:imeOptions="flagNoExtractUi"
android:inputType="textCapSentences|textMultiLine"
android:maxLength="16384"
android:layout_marginLeft="54dp"
android:layout_marginRight="54dp"
android:layout_marginBottom="4dp"
android:paddingBottom="10dp"
android:paddingTop="4dp"
android:textCursorDrawable="@null"
android:textColor="#000000"/>
<ImageView
<FrameLayout
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginTop="2dp"
android:id="@+id/chat_attach_button"
android:enabled="false"
android:layout_gravity="bottom|right"/>
<org.telegram.ui.Views.FrameLayoutFixed
android:layout_height="48dp"
android:layout_width="fill_parent"
android:layout_marginTop="2dp"
android:layout_gravity="bottom"
android:background="#ffffff"
android:id="@+id/record_panel"
android:visibility="gone">
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="30dp"
android:orientation="horizontal"
android:id="@+id/slideText">
<ImageView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:src="@drawable/slidearrow"
android:layout_gravity="center_vertical"
android:layout_marginTop="1dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#999999"
android:textSize="12dp"
android:layout_marginLeft="6dp"
android:id="@+id/slideToCancelTextView"
android:layout_gravity="center_vertical"/>
</LinearLayout>
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:src="@drawable/slidearrow"
android:layout_gravity="center_vertical"
android:layout_marginTop="1dp"/>
android:paddingLeft="13dp"
android:orientation="horizontal"
android:background="#ffffffff">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#999999"
android:textSize="12dp"
android:layout_marginLeft="6dp"
android:id="@+id/slideToCancelTextView"
android:layout_gravity="center_vertical"/>
<ImageView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:src="@drawable/rec"
android:layout_gravity="center_vertical"
android:layout_marginTop="1dp"/>
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/recording_time_text"
android:text="00:00"
android:textColor="#4d4c4b"
android:textSize="16dp"
android:layout_gravity="center_vertical"
android:layout_marginLeft="6dp"/>
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="center_vertical"
android:paddingLeft="13dp"
android:orientation="horizontal"
android:background="#ffffffff">
</LinearLayout>
<ImageView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:src="@drawable/rec"
android:layout_gravity="center_vertical"
android:layout_marginTop="1dp"/>
</org.telegram.ui.Views.FrameLayoutFixed>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/recording_time_text"
android:text="00:00"
android:textColor="#4d4c4b"
android:textSize="16dp"
android:layout_gravity="center_vertical"
android:layout_marginLeft="6dp"/>
</FrameLayout>
</LinearLayout>
</org.telegram.ui.Views.FrameLayoutFixed>
<ImageButton
<FrameLayout
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginTop="2dp"
android:scaleType="centerInside"
android:id="@+id/chat_audio_send_button"
android:layout_alignParentRight="true"
android:layout_alignBottom="@+id/chat_text_edit"
android:enabled="false"
android:src="@drawable/mic_button_states"
android:paddingRight="4dp"
android:background="@android:color/white"/>
android:layout_gravity="bottom"
android:layout_marginTop="2dp">
</RelativeLayout>
<ImageButton
android:layout_width="48dp"
android:layout_height="48dp"
android:scaleType="centerInside"
android:id="@+id/chat_audio_send_button"
android:enabled="false"
android:src="@drawable/mic_button_states"
android:paddingRight="4dp"
android:background="@android:color/white"/>
<ImageButton
android:layout_width="48dp"
android:layout_height="48dp"
android:scaleType="centerInside"
android:id="@+id/chat_send_button"
android:enabled="false"
android:src="@drawable/ic_send"
android:background="@android:color/transparent"/>
</FrameLayout>
</LinearLayout>
<FrameLayout
android:layout_height="48dp"

View File

@ -1,36 +0,0 @@
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:layout_gravity="top">
<TextView
android:textSize="18dp"
android:textColor="#333333"
android:id="@+id/settings_row_text"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_marginLeft="12dp"
android:layout_marginRight="8dp"
android:gravity="center_vertical"
android:layout_gravity="top"/>
<TextView
android:textSize="18dp"
android:textColor="#999999"
android:id="@+id/settings_row_text_detail"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_marginLeft="8dp"
android:layout_marginRight="12dp"
android:gravity="center_vertical"
android:layout_gravity="right"/>
<View
android:background="@color/divider"
android:layout_width="fill_parent"
android:layout_height="1px"
android:layout_gravity="bottom"
android:id="@+id/settings_row_divider"/>
</FrameLayout>

View File

@ -1,24 +0,0 @@
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_gravity="right|center_vertical"
android:minHeight="60dp">
<TextView
android:layout_height="fill_parent"
android:layout_width="wrap_content"
android:drawableLeft="@drawable/ic_done"
android:textColor="#ffffff"
android:textSize="14dp"
android:textStyle="bold"
android:gravity="center"
android:layout_gravity="center"
android:id="@+id/done_button"
android:drawablePadding="8dp"
android:paddingRight="16dp"
android:paddingLeft="16dp"
android:minHeight="60dp"
android:textAllCaps="true"/>
</FrameLayout>

View File

@ -1,276 +0,0 @@
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#fafafa"
android:fillViewport="true">
<org.telegram.ui.Views.FrameLayoutFixed
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="top|left">
<org.telegram.ui.LoginActivityPhoneView
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:visibility="visible"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="30dp"
android:layout_gravity="top|left"
android:id="@+id/login_page1">
<TextView
android:layout_width="fill_parent"
android:layout_height="50dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:id="@+id/login_coutry_textview"
android:textSize="20dp"
android:paddingTop="10dp"
android:gravity="left|center_horizontal"
android:textIsSelectable="false"
android:textColor="#000000"
android:paddingLeft="12dp"
android:paddingRight="12dp"
android:maxLines="1"
android:background="@drawable/spinner_states"/>
<View
android:layout_width="fill_parent"
android:layout_height="1px"
android:paddingLeft="12dp"
android:paddingRight="12dp"
android:background="#808080"
android:layout_marginTop="-6.5dp"
android:layout_marginLeft="24dp"
android:layout_marginRight="24dp"/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_gravity="top|left"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="+"
android:textColor="#a6a6a6"
android:textSize="20dp"
android:layout_marginLeft="8dp"
android:layout_gravity="top|left"/>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/login_county_code_field"
android:width="70dp"
android:editable="true"
android:inputType="phone"
android:maxLength="4"
android:maxLines="1"
android:textSize="18dp"
android:gravity="center"
android:imeOptions="actionNext|flagNoExtractUi"
android:textCursorDrawable="@null"
android:textColor="#000000"
android:layout_gravity="top|left"/>
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/login_phone_field"
android:inputType="phone"
android:maxLines="1"
android:textSize="18dp"
android:layout_marginRight="20dp"
android:imeOptions="actionNext|flagNoExtractUi"
android:textCursorDrawable="@null"
android:textColor="#000000"
android:textColorHint="#979797"
android:gravity="center_vertical"
android:layout_gravity="top|left"/>
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/login_confirm_text"
android:layout_marginTop="28dp"
android:textColor="#808080"
android:layout_gravity="center_horizontal"
android:textSize="16dp"
android:gravity="center"
android:layout_marginBottom="10dp"
android:lineSpacingExtra="2dp"/>
</org.telegram.ui.LoginActivityPhoneView>
<org.telegram.ui.LoginActivitySmsView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="30dp"
android:visibility="gone"
android:id="@+id/login_page2"
android:layout_gravity="top|left"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/login_sms_confirm_text"
android:textColor="#808080"
android:textSize="16dp"
android:gravity="center_horizontal"
android:layout_gravity="center_horizontal"
android:lineSpacingExtra="2dp"/>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="numberDecimal"
android:width="220dp"
android:id="@+id/login_sms_code_field"
android:layout_marginTop="20dp"
android:gravity="center_horizontal"
android:maxLines="1"
android:editable="true"
android:textSize="18dp"
android:imeOptions="actionNext|flagNoExtractUi"
android:textCursorDrawable="@null"
android:layout_gravity="center_horizontal"
android:textColor="#000000"
android:textColorHint="#979797"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/login_time_text"
android:layout_marginTop="20dp"
android:gravity="center_horizontal"
android:layout_gravity="center_horizontal"
android:textSize="16dp"
android:textColor="#808080"
android:lineSpacingExtra="2dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/login_problem"
android:gravity="center_horizontal"
android:layout_gravity="center_horizontal"
android:textSize="16dp"
android:textColor="#316f9f"
android:lineSpacingExtra="2dp"
android:paddingTop="2dp"
android:paddingBottom="12dp"/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@+id/spinner"
android:gravity="center_horizontal|bottom"
android:layout_gravity="top|left">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/wrong_number"
android:gravity="center"
android:textSize="16dp"
android:textColor="#316f9f"
android:lineSpacingExtra="2dp"
android:layout_gravity="bottom|center_horizontal"
android:paddingTop="24dp"
android:layout_marginBottom="10dp"/>
</LinearLayout>
</org.telegram.ui.LoginActivitySmsView>
<org.telegram.ui.LoginActivityRegisterView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="30dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:orientation="vertical"
android:id="@+id/login_page3"
android:visibility="gone"
android:layout_gravity="top|left">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/login_register_info"
android:layout_marginTop="8dp"
android:textColor="#808080"
android:gravity="center_horizontal"
android:layout_gravity="center_horizontal"
android:textSize="16dp"/>
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/login_first_name_field"
android:maxLines="1"
android:textSize="18dp"
android:imeOptions="actionNext|flagNoExtractUi"
android:layout_marginLeft="40dp"
android:layout_marginRight="40dp"
android:layout_marginTop="34dp"
android:lines="1"
android:capitalize="words"
android:textCursorDrawable="@null"
android:textColor="#000000"
android:textColorHint="#979797"/>
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/login_last_name_field"
android:textSize="18dp"
android:imeOptions="actionNext|flagNoExtractUi"
android:layout_marginLeft="40dp"
android:layout_marginRight="40dp"
android:lines="1"
android:maxLines="1"
android:capitalize="words"
android:autoText="false"
android:textCursorDrawable="@null"
android:textColor="#000000"
android:textColorHint="#979797"
android:layout_marginTop="10dp"/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@+id/spinner"
android:gravity="center_horizontal|bottom"
android:minHeight="140dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="30dp"
android:id="@+id/changed_mind"
android:gravity="center"
android:textSize="16dp"
android:textColor="#316f9f"
android:lineSpacingExtra="2dp"
android:layout_gravity="bottom|center_horizontal"
android:layout_marginTop="-40dp"
android:layout_marginBottom="20dp"/>
</LinearLayout>
</org.telegram.ui.LoginActivityRegisterView>
</org.telegram.ui.Views.FrameLayoutFixed>
</ScrollView>

View File

@ -3,7 +3,8 @@
android:layout_height="match_parent"
android:layout_gravity="top">
<GridView android:id="@+id/media_grid"
<GridView
android:id="@+id/media_grid"
android:paddingLeft="2dp"
android:paddingRight="2dp"
android:paddingBottom="2dp"
@ -19,7 +20,8 @@
android:listSelector="@drawable/list_selector"
android:layout_gravity="top"/>
<TextView android:layout_width="match_parent"
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textColor="#808080"
android:gravity="center"
@ -33,12 +35,12 @@
android:layout_height="fill_parent"
android:gravity="center"
android:orientation="vertical"
android:visibility="gone" >
android:visibility="gone">
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
</ProgressBar>
android:layout_height="wrap_content"/>
</LinearLayout>
</FrameLayout>

View File

@ -1,11 +1,12 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="100dp"
android:layout_height="100dp">
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:paddingTop="6dp"
android:paddingBottom="6dp">
</ProgressBar>
android:paddingBottom="6dp"/>
</FrameLayout>

View File

@ -66,7 +66,11 @@
android:ems="10"
android:inputType="textCapSentences|textMultiLine"
android:layout_alignParentTop="true"
android:paddingBottom="12dp"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp"
android:layout_marginBottom="4dp"
android:paddingBottom="10dp"
android:paddingTop="4dp"
android:maxLength="16384"
android:textCursorDrawable="@null"
android:textColor="#000000"/>

View File

@ -10,7 +10,6 @@
android:id="@+id/background_image"/>
<ProgressBar
android:background="#99000000"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_gravity="center"

View File

@ -35,6 +35,7 @@
<item name="android:colorPrimaryDark">#33000000</item>
<item name="android:colorPrimary">#54759e</item>
<item name="android:alertDialogTheme">@style/Theme.TMessages.Dialog.Alert</item>
<item name="android:colorControlActivated">#678cb9</item>
</style>
<style name="Theme.TMessages.PopupNotification" parent="Theme.TMessages">
@ -46,7 +47,7 @@
</style>
<style name="Theme.TMessages.Dialog.Alert" parent="android:style/Theme.Material.Light.Dialog.Alert">
<item name="android:colorAccent">#54759e</item>
<item name="android:colorAccent">#678cb9</item>
</style>
<!--ACTION BAR-->

View File

@ -9,7 +9,7 @@
<string name="LanguageCode">en</string>
<!--signin view-->
<string name="YourPhone">Your phone</string>
<string name="StartText">Please confirm your country code\nand enter your phone number.</string>
<string name="StartText">Please confirm your country code and enter your phone number.</string>
<string name="ChooseCountry">Choose a country</string>
<string name="WrongCountry">Wrong country code</string>
<!--code enter view-->
@ -306,6 +306,37 @@
<string name="Gallery">Gallery</string>
<string name="AllPhotos">All Photos</string>
<string name="NoPhotos">No photos yet</string>
<!--privacy settings-->
<string name="PrivacySettings">Privacy and Security</string>
<string name="PrivacyTitle">Privacy</string>
<string name="PrivacyLastSeen">Last Seen</string>
<string name="LastSeenEverybody">Everybody</string>
<string name="LastSeenContacts">My Contacts</string>
<string name="LastSeenNobody">Nobody</string>
<string name="LastSeenEverybodyMinus">Everybody (-%1$d)</string>
<string name="LastSeenContactsPlus">My Contacts (+%1$d)</string>
<string name="LastSeenContactsMinus">My Contacts (-%1$d)</string>
<string name="LastSeenContactsMinusPlus">My Contacts (-%1$d, +%2$d)</string>
<string name="LastSeenNobodyPlus">Nobody (+%1$d)</string>
<string name="SecurityTitle">Security</string>
<string name="DeleteAccountTitle">Delete my account</string>
<string name="DeleteAccountIfAwayFor">If Away For</string>
<string name="DeleteAccountHelp">If you do not log in at least once within this period, your account will be deleted along with all groups, messages and contacts.</string>
<string name="DeleteAccountNowConfirmation">Delete your account?</string>
<string name="DeleteAccountNever">Never</string>
<string name="LastSeenHelp">Change who can see your Last Seen time.</string>
<string name="CustomHelp">Important: you won\'t be able to see Last Seen times for people with whom you don\'t share your Last Seen time. Approximate last seen will be shown instead (recently, within a week, witin a month).</string>
<string name="AlwaysShareWith">Always Share With</string>
<string name="NeverShareWith">Never Share With</string>
<string name="CustomShareSettingsHelp">These settings will override the values above.</string>
<string name="AlwaysShareWithTitle">Always Share</string>
<string name="AlwaysShareWithPlaceholder">Always share with users...</string>
<string name="NeverShareWithTitle">Never Share</string>
<string name="NeverShareWithPlaceholder">Never share with users...</string>
<string name="EmpryUsersPlaceholder">Add Users</string>
<string name="PrivacyAddUsers">Add %1$s to this list?</string>
<string name="PrivacyFloodControlError">Sorry, too many requests. Unable to change privacy settings now, please wait.</string>
<!--edit video view-->
<string name="EditVideo">Edit Video</string>
<string name="OriginalVideo">Original Video</string>
@ -386,6 +417,7 @@
<string name="AreYouSureUnblockContact">Are you sure you want to unblock this contact?</string>
<string name="AreYouSureDeleteContact">Are you sure you want to delete this contact?</string>
<string name="AreYouSureSecretChat">Are you sure you want to start a secret chat?</string>
<string name="AreYouSureRegistration">Are you sure you want to cancel registration?</string>
<string name="ForwardFromMyName">forward from my name</string>
<string name="SendMessagesToGroup">Send messages to %1$s?</string>
<string name="ForwardMessagesToGroup">Forward messages to %1$s?</string>
@ -473,6 +505,12 @@
<string name="Weeks_few">%1$d weeks</string>
<string name="Weeks_many">%1$d weeks</string>
<string name="Weeks_other">%1$d weeks</string>
<string name="Users_zero">%1$d users</string>
<string name="Users_one">%1$d user</string>
<string name="Users_two">%1$d users</string>
<string name="Users_few">%1$d users</string>
<string name="Users_many">%1$d users</string>
<string name="Users_other">%1$d users</string>
<!--date formatters-->
<string name="formatterMonth">MMM dd</string>
<string name="formatterYear">dd.MM.yy</string>