This commit is contained in:
B. Petersen
2017-01-05 13:10:11 +01:00
parent 53447c793a
commit ebcb132acf
6 changed files with 39 additions and 675 deletions
@@ -79,8 +79,6 @@ public class LocaleController {
private String languageOverride;
private boolean changingConfiguration = false;
private HashMap<String, String> translitChars;
private class TimeZoneChangedReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
@@ -902,580 +900,6 @@ public class LocaleController {
}
*/
public static String formatUserStatus(TLRPC.User user) {
if (user != null && user.status != null && user.status.expires == 0) {
if (user.status instanceof TLRPC.TL_userStatusRecently) {
user.status.expires = -100;
} else if (user.status instanceof TLRPC.TL_userStatusLastWeek) {
user.status.expires = -101;
} else if (user.status instanceof TLRPC.TL_userStatusLastMonth) {
user.status.expires = -102;
}
}
if (user != null && user.status != null && user.status.expires <= 0) {
if (MessagesController.getInstance().onlinePrivacy.containsKey(user.id)) {
return getString("Online", R.string.Online);
}
}
if (user == null || user.status == null || user.status.expires == 0 ) {
return getString("ALongTimeAgo", R.string.ALongTimeAgo);
} else {
int currentTime = ConnectionsManager.getInstance().getCurrentTime();
if (user.status.expires > currentTime) {
return getString("Online", R.string.Online);
} else {
if (user.status.expires == -1) {
return getString("Invisible", R.string.Invisible);
} else if (user.status.expires == -100) {
return getString("Lately", R.string.Lately);
} else if (user.status.expires == -101) {
return getString("WithinAWeek", R.string.WithinAWeek);
} else if (user.status.expires == -102) {
return getString("WithinAMonth", R.string.WithinAMonth);
} else {
return formatDateOnline(user.status.expires);
}
}
}
}
public String getTranslitString(String src) {
if (translitChars == null) {
translitChars = new HashMap<>(520);
translitChars.put("ȼ", "c");
translitChars.put("", "n");
translitChars.put("ɖ", "d");
translitChars.put("ỿ", "y");
translitChars.put("", "o");
translitChars.put("ø", "o");
translitChars.put("", "a");
translitChars.put("ʯ", "h");
translitChars.put("ŷ", "y");
translitChars.put("ʞ", "k");
translitChars.put("", "u");
translitChars.put("", "aa");
translitChars.put("ij", "ij");
translitChars.put("", "l");
translitChars.put("ɪ", "i");
translitChars.put("", "b");
translitChars.put("ʀ", "r");
translitChars.put("ě", "e");
translitChars.put("", "ffi");
translitChars.put("ơ", "o");
translitChars.put("", "r");
translitChars.put("", "o");
translitChars.put("ǐ", "i");
translitChars.put("", "p");
translitChars.put("ý", "y");
translitChars.put("", "e");
translitChars.put("", "o");
translitChars.put("", "a");
translitChars.put("ʙ", "b");
translitChars.put("", "e");
translitChars.put("ƈ", "c");
translitChars.put("ɦ", "h");
translitChars.put("", "b");
translitChars.put("", "s");
translitChars.put("đ", "d");
translitChars.put("", "o");
translitChars.put("ɟ", "j");
translitChars.put("", "a");
translitChars.put("ɏ", "y");
translitChars.put("л", "l");
translitChars.put("ʌ", "v");
translitChars.put("", "p");
translitChars.put("", "fi");
translitChars.put("", "k");
translitChars.put("", "d");
translitChars.put("", "l");
translitChars.put("ė", "e");
translitChars.put("ё", "yo");
translitChars.put("", "k");
translitChars.put("ċ", "c");
translitChars.put("ʁ", "r");
translitChars.put("ƕ", "hv");
translitChars.put("ƀ", "b");
translitChars.put("", "o");
translitChars.put("ȣ", "ou");
translitChars.put("ǰ", "j");
translitChars.put("", "g");
translitChars.put("", "n");
translitChars.put("ɉ", "j");
translitChars.put("ǧ", "g");
translitChars.put("dz", "dz");
translitChars.put("ź", "z");
translitChars.put("", "au");
translitChars.put("ǖ", "u");
translitChars.put("", "g");
translitChars.put("ȯ", "o");
translitChars.put("ɐ", "a");
translitChars.put("ą", "a");
translitChars.put("õ", "o");
translitChars.put("ɻ", "r");
translitChars.put("", "o");
translitChars.put("ǟ", "a");
translitChars.put("ȴ", "l");
translitChars.put("ʂ", "s");
translitChars.put("", "fl");
translitChars.put("ȉ", "i");
translitChars.put("", "e");
translitChars.put("", "n");
translitChars.put("ï", "i");
translitChars.put("ñ", "n");
translitChars.put("", "i");
translitChars.put("ʇ", "t");
translitChars.put("", "z");
translitChars.put("", "y");
translitChars.put("ȳ", "y");
translitChars.put("", "s");
translitChars.put("ɽ", "r");
translitChars.put("ĝ", "g");
translitChars.put("в", "v");
translitChars.put("", "u");
translitChars.put("", "k");
translitChars.put("", "et");
translitChars.put("ī", "i");
translitChars.put("ť", "t");
translitChars.put("", "c");
translitChars.put("ʟ", "l");
translitChars.put("", "av");
translitChars.put("û", "u");
translitChars.put("æ", "ae");
translitChars.put("и", "i");
translitChars.put("ă", "a");
translitChars.put("ǘ", "u");
translitChars.put("", "s");
translitChars.put("", "r");
translitChars.put("", "a");
translitChars.put("ƃ", "b");
translitChars.put("", "h");
translitChars.put("", "s");
translitChars.put("", "e");
translitChars.put("ʜ", "h");
translitChars.put("", "x");
translitChars.put("", "k");
translitChars.put("", "d");
translitChars.put("ƣ", "oi");
translitChars.put("", "p");
translitChars.put("ħ", "h");
translitChars.put("", "v");
translitChars.put("", "w");
translitChars.put("ǹ", "n");
translitChars.put("ɯ", "m");
translitChars.put("ɡ", "g");
translitChars.put("ɴ", "n");
translitChars.put("", "p");
translitChars.put("", "v");
translitChars.put("ū", "u");
translitChars.put("", "b");
translitChars.put("", "p");
translitChars.put("ь", "");
translitChars.put("å", "a");
translitChars.put("ɕ", "c");
translitChars.put("", "o");
translitChars.put("", "a");
translitChars.put("ƒ", "f");
translitChars.put("ǣ", "ae");
translitChars.put("", "vy");
translitChars.put("", "ff");
translitChars.put("", "r");
translitChars.put("ô", "o");
translitChars.put("ǿ", "o");
translitChars.put("", "u");
translitChars.put("ȥ", "z");
translitChars.put("", "f");
translitChars.put("", "d");
translitChars.put("ȇ", "e");
translitChars.put("ȕ", "u");
translitChars.put("п", "p");
translitChars.put("ȵ", "n");
translitChars.put("ʠ", "q");
translitChars.put("", "a");
translitChars.put("ǩ", "k");
translitChars.put("ĩ", "i");
translitChars.put("", "u");
translitChars.put("ŧ", "t");
translitChars.put("ɾ", "r");
translitChars.put("ƙ", "k");
translitChars.put("", "t");
translitChars.put("", "q");
translitChars.put("", "a");
translitChars.put("н", "n");
translitChars.put("ʄ", "j");
translitChars.put("ƚ", "l");
translitChars.put("", "f");
translitChars.put("д", "d");
translitChars.put("", "s");
translitChars.put("", "r");
translitChars.put("", "v");
translitChars.put("ɵ", "o");
translitChars.put("", "c");
translitChars.put("", "u");
translitChars.put("", "z");
translitChars.put("", "u");
translitChars.put("ň", "n");
translitChars.put("ʍ", "w");
translitChars.put("", "a");
translitChars.put("lj", "lj");
translitChars.put("ɓ", "b");
translitChars.put("ɼ", "r");
translitChars.put("ò", "o");
translitChars.put("", "w");
translitChars.put("ɗ", "d");
translitChars.put("", "ay");
translitChars.put("ư", "u");
translitChars.put("", "b");
translitChars.put("ǜ", "u");
translitChars.put("", "e");
translitChars.put("ǡ", "a");
translitChars.put("ɥ", "h");
translitChars.put("", "o");
translitChars.put("ǔ", "u");
translitChars.put("ʎ", "y");
translitChars.put("ȱ", "o");
translitChars.put("", "e");
translitChars.put("ế", "e");
translitChars.put("ĭ", "i");
translitChars.put("", "e");
translitChars.put("", "t");
translitChars.put("", "d");
translitChars.put("", "h");
translitChars.put("", "s");
translitChars.put("ë", "e");
translitChars.put("", "m");
translitChars.put("ö", "o");
translitChars.put("é", "e");
translitChars.put("ı", "i");
translitChars.put("ď", "d");
translitChars.put("", "m");
translitChars.put("", "y");
translitChars.put("я", "ya");
translitChars.put("ŵ", "w");
translitChars.put("", "e");
translitChars.put("", "u");
translitChars.put("ƶ", "z");
translitChars.put("ĵ", "j");
translitChars.put("", "d");
translitChars.put("ŭ", "u");
translitChars.put("ʝ", "j");
translitChars.put("ж", "zh");
translitChars.put("ê", "e");
translitChars.put("ǚ", "u");
translitChars.put("ġ", "g");
translitChars.put("", "r");
translitChars.put("ƞ", "n");
translitChars.put("ъ", "");
translitChars.put("", "e");
translitChars.put("", "s");
translitChars.put("", "d");
translitChars.put("ķ", "k");
translitChars.put("", "ae");
translitChars.put("ɘ", "e");
translitChars.put("", "o");
translitChars.put("ḿ", "m");
translitChars.put("", "f");
translitChars.put("а", "a");
translitChars.put("", "a");
translitChars.put("", "oo");
translitChars.put("", "m");
translitChars.put("", "p");
translitChars.put("ц", "ts");
translitChars.put("", "u");
translitChars.put("", "k");
translitChars.put("", "h");
translitChars.put("ţ", "t");
translitChars.put("", "p");
translitChars.put("", "m");
translitChars.put("á", "a");
translitChars.put("", "n");
translitChars.put("", "v");
translitChars.put("è", "e");
translitChars.put("", "z");
translitChars.put("", "d");
translitChars.put("", "p");
translitChars.put("м", "m");
translitChars.put("ɫ", "l");
translitChars.put("", "z");
translitChars.put("ɱ", "m");
translitChars.put("", "r");
translitChars.put("", "v");
translitChars.put("ũ", "u");
translitChars.put("ß", "ss");
translitChars.put("т", "t");
translitChars.put("ĥ", "h");
translitChars.put("", "t");
translitChars.put("ʐ", "z");
translitChars.put("", "r");
translitChars.put("ɲ", "n");
translitChars.put("à", "a");
translitChars.put("", "y");
translitChars.put("", "y");
translitChars.put("", "oe");
translitChars.put("ы", "i");
translitChars.put("", "x");
translitChars.put("ȗ", "u");
translitChars.put("", "j");
translitChars.put("", "a");
translitChars.put("ʑ", "z");
translitChars.put("", "s");
translitChars.put("", "i");
translitChars.put("", "ao");
translitChars.put("ɀ", "z");
translitChars.put("ÿ", "y");
translitChars.put("ǝ", "e");
translitChars.put("ǭ", "o");
translitChars.put("", "d");
translitChars.put("", "l");
translitChars.put("ù", "u");
translitChars.put("", "a");
translitChars.put("", "b");
translitChars.put("", "u");
translitChars.put("к", "k");
translitChars.put("", "a");
translitChars.put("", "t");
translitChars.put("ƴ", "y");
translitChars.put("", "t");
translitChars.put("з", "z");
translitChars.put("", "l");
translitChars.put("ȷ", "j");
translitChars.put("", "z");
translitChars.put("", "h");
translitChars.put("", "w");
translitChars.put("", "k");
translitChars.put("", "o");
translitChars.put("î", "i");
translitChars.put("ģ", "g");
translitChars.put("ȅ", "e");
translitChars.put("ȧ", "a");
translitChars.put("", "a");
translitChars.put("щ", "sch");
translitChars.put("ɋ", "q");
translitChars.put("", "t");
translitChars.put("", "um");
translitChars.put("", "c");
translitChars.put("", "x");
translitChars.put("", "u");
translitChars.put("", "i");
translitChars.put("", "r");
translitChars.put("ś", "s");
translitChars.put("", "o");
translitChars.put("", "y");
translitChars.put("", "s");
translitChars.put("nj", "nj");
translitChars.put("ȁ", "a");
translitChars.put("", "t");
translitChars.put("ĺ", "l");
translitChars.put("ž", "z");
translitChars.put("", "th");
translitChars.put("ƌ", "d");
translitChars.put("ș", "s");
translitChars.put("š", "s");
translitChars.put("", "u");
translitChars.put("", "e");
translitChars.put("", "s");
translitChars.put("ɇ", "e");
translitChars.put("", "u");
translitChars.put("", "o");
translitChars.put("ȿ", "s");
translitChars.put("", "v");
translitChars.put("", "is");
translitChars.put("", "o");
translitChars.put("ɛ", "e");
translitChars.put("ǻ", "a");
translitChars.put("", "ffl");
translitChars.put("", "o");
translitChars.put("ȋ", "i");
translitChars.put("", "ue");
translitChars.put("ȡ", "d");
translitChars.put("", "z");
translitChars.put("", "w");
translitChars.put("", "a");
translitChars.put("", "t");
translitChars.put("ğ", "g");
translitChars.put("ɳ", "n");
translitChars.put("ʛ", "g");
translitChars.put("", "u");
translitChars.put("ф", "f");
translitChars.put("", "a");
translitChars.put("", "n");
translitChars.put("ɨ", "i");
translitChars.put("", "r");
translitChars.put("ǎ", "a");
translitChars.put("ſ", "s");
translitChars.put("у", "u");
translitChars.put("ȫ", "o");
translitChars.put("ɿ", "r");
translitChars.put("ƭ", "t");
translitChars.put("", "i");
translitChars.put("ǽ", "ae");
translitChars.put("", "v");
translitChars.put("ɶ", "oe");
translitChars.put("", "m");
translitChars.put("ż", "z");
translitChars.put("ĕ", "e");
translitChars.put("", "av");
translitChars.put("", "o");
translitChars.put("", "e");
translitChars.put("ɬ", "l");
translitChars.put("", "i");
translitChars.put("", "d");
translitChars.put("", "st");
translitChars.put("", "l");
translitChars.put("ŕ", "r");
translitChars.put("", "ou");
translitChars.put("ʈ", "t");
translitChars.put("ā", "a");
translitChars.put("э", "e");
translitChars.put("", "e");
translitChars.put("", "o");
translitChars.put("ç", "c");
translitChars.put("", "s");
translitChars.put("", "a");
translitChars.put("ų", "u");
translitChars.put("", "a");
translitChars.put("ǥ", "g");
translitChars.put("р", "r");
translitChars.put("", "k");
translitChars.put("", "z");
translitChars.put("ŝ", "s");
translitChars.put("", "e");
translitChars.put("ɠ", "g");
translitChars.put("", "l");
translitChars.put("", "f");
translitChars.put("", "x");
translitChars.put("х", "h");
translitChars.put("ǒ", "o");
translitChars.put("ę", "e");
translitChars.put("", "o");
translitChars.put("ƫ", "t");
translitChars.put("ǫ", "o");
translitChars.put("", "i");
translitChars.put("", "n");
translitChars.put("ć", "c");
translitChars.put("", "g");
translitChars.put("", "w");
translitChars.put("", "d");
translitChars.put("", "l");
translitChars.put("ч", "ch");
translitChars.put("œ", "oe");
translitChars.put("", "r");
translitChars.put("ļ", "l");
translitChars.put("ȑ", "r");
translitChars.put("ȭ", "o");
translitChars.put("", "n");
translitChars.put("", "ae");
translitChars.put("ŀ", "l");
translitChars.put("ä", "a");
translitChars.put("ƥ", "p");
translitChars.put("", "o");
translitChars.put("į", "i");
translitChars.put("ȓ", "r");
translitChars.put("dž", "dz");
translitChars.put("", "g");
translitChars.put("", "u");
translitChars.put("ō", "o");
translitChars.put("ľ", "l");
translitChars.put("", "w");
translitChars.put("ț", "t");
translitChars.put("ń", "n");
translitChars.put("ɍ", "r");
translitChars.put("ȃ", "a");
translitChars.put("ü", "u");
translitChars.put("", "l");
translitChars.put("", "o");
translitChars.put("", "o");
translitChars.put("", "b");
translitChars.put("ɹ", "r");
translitChars.put("", "r");
translitChars.put("ʏ", "y");
translitChars.put("", "f");
translitChars.put("", "h");
translitChars.put("ŏ", "o");
translitChars.put("ú", "u");
translitChars.put("", "r");
translitChars.put("ʮ", "h");
translitChars.put("ó", "o");
translitChars.put("ů", "u");
translitChars.put("", "o");
translitChars.put("", "p");
translitChars.put("", "i");
translitChars.put("", "u");
translitChars.put("ã", "a");
translitChars.put("", "i");
translitChars.put("", "t");
translitChars.put("", "e");
translitChars.put("", "u");
translitChars.put("í", "i");
translitChars.put("ɔ", "o");
translitChars.put("с", "s");
translitChars.put("й", "i");
translitChars.put("ɺ", "r");
translitChars.put("ɢ", "g");
translitChars.put("ř", "r");
translitChars.put("", "h");
translitChars.put("ű", "u");
translitChars.put("ȍ", "o");
translitChars.put("ш", "sh");
translitChars.put("", "l");
translitChars.put("", "h");
translitChars.put("ȶ", "t");
translitChars.put("ņ", "n");
translitChars.put("", "e");
translitChars.put("ì", "i");
translitChars.put("", "w");
translitChars.put("б", "b");
translitChars.put("ē", "e");
translitChars.put("", "e");
translitChars.put("ł", "l");
translitChars.put("", "o");
translitChars.put("ɭ", "l");
translitChars.put("", "y");
translitChars.put("", "j");
translitChars.put("", "k");
translitChars.put("ṿ", "v");
translitChars.put("ȩ", "e");
translitChars.put("â", "a");
translitChars.put("ş", "s");
translitChars.put("ŗ", "r");
translitChars.put("ʋ", "v");
translitChars.put("", "a");
translitChars.put("", "c");
translitChars.put("", "e");
translitChars.put("ɰ", "m");
translitChars.put("е", "e");
translitChars.put("", "w");
translitChars.put("ȏ", "o");
translitChars.put("č", "c");
translitChars.put("ǵ", "g");
translitChars.put("ĉ", "c");
translitChars.put("ю", "yu");
translitChars.put("", "o");
translitChars.put("", "k");
translitChars.put("", "q");
translitChars.put("г", "g");
translitChars.put("", "o");
translitChars.put("", "s");
translitChars.put("", "o");
translitChars.put("ȟ", "h");
translitChars.put("ő", "o");
translitChars.put("", "tz");
translitChars.put("", "e");
translitChars.put("о", "o");
}
StringBuilder dst = new StringBuilder(src.length());
int len = src.length();
for (int a = 0; a < len; a++) {
String ch = src.substring(a, a + 1);
String tch = translitChars.get(ch);
if (tch != null) {
dst.append(tch);
} else {
dst.append(ch);
}
}
return dst.toString();
}
abstract public static class PluralRules {
abstract int quantityForNumber(int n);
}
@@ -205,7 +205,6 @@ public class TLRPC {
public String username;
public String phone;
public UserProfilePhoto photo;
public UserStatus status;
public int flags;
public boolean self;
public boolean contact;
@@ -314,25 +313,6 @@ public class TLRPC {
public static class TL_inputStickerSetEmpty extends InputStickerSet {
}
public static class TL_inputStickerSetID extends InputStickerSet {
}
public static class TL_inputStickerSetShortName extends InputStickerSet {
}
public static class UserStatus extends TLObject {
public int expires;
}
public static class TL_userStatusLastWeek extends UserStatus {
}
public static class TL_userStatusLastMonth extends UserStatus {
}
public static class TL_userStatusRecently extends UserStatus {
}
public static class InputEncryptedFile extends TLObject {
public long id;
public int parts;
@@ -286,15 +286,7 @@ public class ProfileSearchCell extends BaseCell {
if (subLabel != null) {
onlineString = subLabel;
} else if (user != null) {
/*if (user.bot) {
onlineString = LocaleController.getString("Bot", R.string.Bot);
} else*/ {
onlineString = LocaleController.formatUserStatus(user);
if (user != null && (user.id == UserConfig.getClientUserId() || user.status != null && user.status.expires > ConnectionsManager.getInstance().getCurrentTime())) {
currentOnlinePaint = onlinePaint;
onlineString = LocaleController.getString("Online", R.string.Online);
}
}
onlineString = "ErrOnline";
}
CharSequence onlineStringFinal = TextUtils.ellipsize(onlineString, currentOnlinePaint, onlineWidth - AndroidUtilities.dp(12), TextUtils.TruncateAt.END);
@@ -385,9 +377,6 @@ public class ProfileSearchCell extends BaseCell {
}
if (!continueUpdate && (mask & MessagesController.UPDATE_MASK_STATUS) != 0 && user != null) {
int newStatus = 0;
if (user.status != null) {
newStatus = user.status.expires;
}
if (newStatus != lastStatus) {
continueUpdate = true;
}
@@ -416,11 +405,7 @@ public class ProfileSearchCell extends BaseCell {
}
if (user != null) {
if (user.status != null) {
lastStatus = user.status.expires;
} else {
lastStatus = 0;
}
lastStatus = 0;
lastName = user.first_name + user.last_name;
} else if (chat != null) {
lastName = chat.title;
@@ -133,6 +133,10 @@ import java.util.regex.Matcher;
public class ChatActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate, DialogsActivity.DialogsActivityDelegate,
PhotoViewer.PhotoViewerProvider {
// the data
private long dialog_id;
public MrChat m_mrChat = new MrChat(0);
// the list view
private RecyclerListView chatListView;
private static final int ROWTYPE_MESSAGE_CELL = 0;
@@ -143,8 +147,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
private MessageObject unreadMessageObject;
// misc
protected TLRPC.Chat currentChat;
public MrChat m_mrChat = new MrChat(0);
private FrameLayout bottomOverlay;
protected ChatActivityEnterView chatActivityEnterView;
private ActionBarMenuItem menuItem;
@@ -161,7 +163,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
private NumberTextView selectedMessagesCountTextView;
private SimpleTextView actionModeTextView;
private SimpleTextView actionModeSubTextView;
private RecyclerListView.OnItemClickListener mentionsOnItemClickListener;
private TextView muteMenuEntry;
private boolean m_canMute;
private FrameLayout pagedownButton;
@@ -192,8 +193,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
private boolean openSearchKeyboard;
private AnimatorSet runningAnimation;
private MessageObject forwaringMessage;
private boolean paused = true;
private boolean wasPaused = false;
@@ -205,13 +204,12 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
private boolean scrollToTopOnResume;
private boolean forceScrollToTop;
private boolean scrollToTopUnReadOnResume;
private long dialog_id;
private HashMap<Integer, MessageObject>[] selectedMessagesIds = new HashMap[]{new HashMap<>(), new HashMap<>()};
private HashMap<Integer, MessageObject>[] selectedMessagesCanCopyIds = new HashMap[]{new HashMap<>(), new HashMap<>()};
private int newUnreadMessageCount;
private HashMap<String, ArrayList<MessageObject>> messagesByDays = new HashMap<>(); // used to add/remove date headlines
private int maxMessageId = Integer.MAX_VALUE;
private int minMessageId = Integer.MIN_VALUE;
@@ -254,28 +252,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
private final static int id_chat_compose_panel = 1000;
RecyclerListView.OnItemLongClickListener onItemLongClickListener = new RecyclerListView.OnItemLongClickListener() {
@Override
public boolean onItemClick(View view, int position) {
if (!actionBar.isActionModeShowed()) {
handleClick(view, true);
return true;
}
return false;
}
};
RecyclerListView.OnItemClickListener onItemClickListener = new RecyclerListView.OnItemClickListener() {
@Override
public void onItemClick(View view, int position) {
if (actionBar.isActionModeShowed()) {
processRowSelect(view);
return;
}
handleClick(view, false);
}
};
public ChatActivity(Bundle args) {
super(args);
}
@@ -284,8 +260,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
public boolean onFragmentCreate() {
dialog_id = arguments.getInt("chat_id", 0);
m_mrChat = MrMailbox.getChat((int)dialog_id);
currentChat = new TLRPC.Chat();
currentChat.id = (int)dialog_id;
startLoadFromMessageId = arguments.getInt("message_id", 0);
scrollToTopOnResume = arguments.getBoolean("scrollToTopOnResume", false);
@@ -1255,8 +1229,26 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
chatLayoutManager.setStackFromEnd(true);
chatListView.setLayoutManager(chatLayoutManager);
contentView.addView(chatListView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
chatListView.setOnItemLongClickListener(onItemLongClickListener);
chatListView.setOnItemClickListener(onItemClickListener);
chatListView.setOnItemLongClickListener(new RecyclerListView.OnItemLongClickListener() {
@Override
public boolean onItemClick(View view, int position) {
if (!actionBar.isActionModeShowed()) {
handleClick(view, true);
return true;
}
return false;
}
});
chatListView.setOnItemClickListener(new RecyclerListView.OnItemClickListener() {
@Override
public void onItemClick(View view, int position) {
if (actionBar.isActionModeShowed()) {
processRowSelect(view);
return;
}
handleClick(view, false);
}
});
chatListView.setOnScrollListener(new RecyclerView.OnScrollListener() {
private float totalDy = 0;
@@ -1628,8 +1620,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
mentionsAdapter.setParentFragment(this);
mentionsAdapter.setChatInfo(info);
mentionsAdapter.setNeedUsernames(currentChat != null);
mentionListView.setOnItemClickListener(mentionsOnItemClickListener = new RecyclerListView.OnItemClickListener() {
mentionsAdapter.setNeedUsernames(m_mrChat.getType()==MrChat.MR_CHAT_GROUP);
mentionListView.setOnItemClickListener(new RecyclerListView.OnItemClickListener() {
@Override
public void onItemClick(View view, int position) {
Object object = mentionsAdapter.getItem(position);
@@ -1742,7 +1734,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
@Override
public void onTextChanged(final CharSequence text, boolean bigChange) {
MediaController.getInstance().setInputFieldHasText(text != null && text.length() != 0 || chatActivityEnterView.isEditingMessage());
MediaController.getInstance().setInputFieldHasText(text != null && text.length() != 0);
if (mentionsAdapter != null && text!=null ) {
mentionsAdapter.searchUsernameOrHashtag(text.toString(), chatActivityEnterView.getCursorPosition(), messages);
}
@@ -1750,7 +1742,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
AndroidUtilities.cancelRunOnUIThread(waitingForCharaterEnterRunnable);
waitingForCharaterEnterRunnable = null;
}
if (chatActivityEnterView.isMessageWebPageSearchEnabled() && (!chatActivityEnterView.isEditingMessage() || !chatActivityEnterView.isEditingCaption())) {
if( chatActivityEnterView.isMessageWebPageSearchEnabled() ) {
if (bigChange) {
searchLinks(text, true);
} else {
@@ -3568,11 +3560,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
});
}
if (chatActivityEnterView == null || !chatActivityEnterView.isEditingMessage()) {
chatListView.setOnItemLongClickListener(onItemLongClickListener);
chatListView.setOnItemClickListener(onItemClickListener);
chatListView.setLongClickable(true);
}
}
@Override
@@ -3588,11 +3575,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
CharSequence draftMessage = null;
if (chatActivityEnterView != null) {
chatActivityEnterView.onPause();
if (!chatActivityEnterView.isEditingMessage()) {
CharSequence text = AndroidUtilities.getTrimmedString(chatActivityEnterView.getFieldText());
if (!TextUtils.isEmpty(text) && !TextUtils.equals(text, "@gif")) {
draftMessage = text;
}
CharSequence text = AndroidUtilities.getTrimmedString(chatActivityEnterView.getFieldText());
if (!TextUtils.isEmpty(text) && !TextUtils.equals(text, "@gif")) {
draftMessage = text;
}
chatActivityEnterView.setFieldFocused(false);
}
@@ -3970,9 +3955,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
object.imageReceiver = imageReceiver;
object.thumb = imageReceiver.getBitmap();
object.radius = imageReceiver.getRoundRadius();
if (view instanceof ChatActionCell && currentChat != null) {
object.dialogId = -currentChat.id;
}
object.dialogId = (int)dialog_id;
return object;
}
}
@@ -4129,7 +4112,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
processRowSelect(cell);
return;
}
if (chat != null && chat != currentChat) {
if (chat != null && chat.id != dialog_id) {
Bundle args = new Bundle();
args.putInt("chat_id", chat.id);
if (postId != 0) {
@@ -647,7 +647,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
if ((int) dialog_id > 0) {
currentUser = MessagesController.getInstance().getUser((int) dialog_id);
}
if (currentUser != null && (currentUser.id == UserConfig.getClientUserId() || currentUser.status != null && currentUser.status.expires < currentTime && !MessagesController.getInstance().onlinePrivacy.containsKey(currentUser.id))) {
if (currentUser != null && (currentUser.id == UserConfig.getClientUserId() || currentUser.status != null && currentUser.status.expires_ < currentTime && !MessagesController.getInstance().onlinePrivacy.containsKey(currentUser.id))) {
return;
}
lastTypingTimeSend = System.currentTimeMillis();
@@ -1934,15 +1934,6 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
}
}
public boolean isEditingMessage() {
return false;
}
public boolean isEditingCaption() {
return false;
}
public boolean hasAudioToSend() {
return audioToSendMessageObject != null;
}
@@ -69,6 +69,7 @@ import android.widget.Toast;
import com.b44t.messenger.AndroidUtilities;
import com.b44t.messenger.ImageLoader;
import com.b44t.messenger.MrChat;
import com.b44t.messenger.MrContact;
import com.b44t.messenger.MrMailbox;
import com.b44t.messenger.exoplayer.AspectRatioFrameLayout;
@@ -2628,7 +2629,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
cropItem.setVisibility(obj instanceof MediaController.PhotoEntry || obj instanceof MediaController.SearchImage && ((MediaController.SearchImage) obj).type == 0 ? View.VISIBLE : View.GONE);
if (parentChatActivity != null /*&& (parentChatActivity.currentEncryptedChat == null || AndroidUtilities.getPeerLayerVersion(parentChatActivity.currentEncryptedChat.layer) >= 46)*/) {
mentionsAdapter.setChatInfo(parentChatActivity.info);
mentionsAdapter.setNeedUsernames(parentChatActivity.currentChat != null);
mentionsAdapter.setNeedUsernames(parentChatActivity.m_mrChat.getType()== MrChat.MR_CHAT_GROUP);
//captionItem.setVisibility(cropItem.getVisibility());
//captionEditText.setVisibility(cropItem.getVisibility());
//needCaptionLayout = captionItem.getVisibility() == View.VISIBLE;