diff --git a/TMessagesProj/build.gradle b/TMessagesProj/build.gradle index 1f1941ed5..1772ff6b5 100644 --- a/TMessagesProj/build.gradle +++ b/TMessagesProj/build.gradle @@ -82,7 +82,7 @@ android { defaultConfig { minSdkVersion 8 targetSdkVersion 19 - versionCode 208 - versionName "1.4.7" + versionCode 211 + versionName "1.4.8" } } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/ConnectionsManager.java b/TMessagesProj/src/main/java/org/telegram/messenger/ConnectionsManager.java index 7e29e4974..9eac980fd 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/ConnectionsManager.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/ConnectionsManager.java @@ -479,7 +479,6 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection. processedMessageIdsSet.remove(sessionId); nextSeqNoInSession.remove(sessionId); processedSessionChanges.remove(sessionId); - pingIdToDate.remove(sessionId); if (sessionId == datacenter.authSessionId) { clearRequestsForRequestClass(RPCRequest.RPCRequestClassGeneric, datacenter); @@ -858,7 +857,7 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection. } } catch(Exception e) { FileLog.e("tmessages", e); - return false; + return true; } return status; } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/ContactsController.java b/TMessagesProj/src/main/java/org/telegram/messenger/ContactsController.java index 37da471aa..65b334bdf 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/ContactsController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/ContactsController.java @@ -592,9 +592,9 @@ public class ContactsController { if (!toImport.isEmpty()) { if (BuildVars.DEBUG_VERSION) { FileLog.e("tmessages", "start import contacts"); - for (TLRPC.TL_inputPhoneContact contact : toImport) { - FileLog.e("tmessages", "add contact " + contact.first_name + " " + contact.last_name + " " + contact.phone); - } +// for (TLRPC.TL_inputPhoneContact contact : toImport) { +// FileLog.e("tmessages", "add contact " + contact.first_name + " " + contact.last_name + " " + contact.phone); +// } } final int count = (int)Math.ceil(toImport.size() / 500.0f); for (int a = 0; a < count; a++) { @@ -614,9 +614,9 @@ public class ContactsController { } TLRPC.TL_contacts_importedContacts res = (TLRPC.TL_contacts_importedContacts)response; if (BuildVars.DEBUG_VERSION) { - for (TLRPC.User user : res.users) { - FileLog.e("tmessages", "received user " + user.first_name + " " + user.last_name + " " + user.phone); - } +// for (TLRPC.User user : res.users) { +// FileLog.e("tmessages", "received user " + user.first_name + " " + user.last_name + " " + user.phone); +// } } MessagesStorage.getInstance().putUsersAndChats(res.users, null, true, true); ArrayList cArr = new ArrayList(); @@ -776,9 +776,9 @@ public class ContactsController { if (user != null) { usersDict.put(user.id, user); - if (BuildVars.DEBUG_VERSION) { - FileLog.e("tmessages", "loaded user contact " + user.first_name + " " + user.last_name + " " + user.phone); - } +// if (BuildVars.DEBUG_VERSION) { +// FileLog.e("tmessages", "loaded user contact " + user.first_name + " " + user.last_name + " " + user.phone); +// } } } @@ -1398,9 +1398,9 @@ public class ContactsController { contactsParams.add(c); req.contacts = contactsParams; req.replace = false; - if (BuildVars.DEBUG_VERSION) { - FileLog.e("tmessages", "add contact " + user.first_name + " " + user.last_name + " " + user.phone); - } +// if (BuildVars.DEBUG_VERSION) { +// FileLog.e("tmessages", "add contact " + user.first_name + " " + user.last_name + " " + user.phone); +// } ConnectionsManager.getInstance().performRpc(req, new RPCRequest.RPCRequestDelegate() { @Override public void run(TLObject response, TLRPC.TL_error error) { @@ -1410,11 +1410,11 @@ public class ContactsController { final TLRPC.TL_contacts_importedContacts res = (TLRPC.TL_contacts_importedContacts)response; MessagesStorage.getInstance().putUsersAndChats(res.users, null, true, true); - if (BuildVars.DEBUG_VERSION) { - for (TLRPC.User user : res.users) { - FileLog.e("tmessages", "received user " + user.first_name + " " + user.last_name + " " + user.phone); - } - } +// if (BuildVars.DEBUG_VERSION) { +// for (TLRPC.User user : res.users) { +// FileLog.e("tmessages", "received user " + user.first_name + " " + user.last_name + " " + user.phone); +// } +// } for (final TLRPC.User u : res.users) { Utilities.globalQueue.postRunnable(new Runnable() { diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/LocaleController.java b/TMessagesProj/src/main/java/org/telegram/messenger/LocaleController.java index 7a13c90b6..80f3a2947 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/LocaleController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/LocaleController.java @@ -8,16 +8,47 @@ package org.telegram.messenger; +import android.app.Activity; +import android.content.SharedPreferences; +import android.content.res.Configuration; +import android.text.format.DateFormat; + import org.telegram.ui.ApplicationLoader; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collections; +import java.util.Comparator; +import java.util.Date; import java.util.HashMap; import java.util.Locale; public class LocaleController { - private String currentLanguage; + public static boolean isRTL = false; + public static FastDateFormat formatterDay; + public static FastDateFormat formatterWeek; + public static FastDateFormat formatterMonth; + public static FastDateFormat formatterYear; + public static FastDateFormat formatterYearMax; + public static FastDateFormat chatDate; + public static FastDateFormat chatFullDate; + private Locale currentLocale; + private Locale systemDefaultLocale; + private LocaleInfo currentLocaleInfo; private HashMap localeValues = new HashMap(); + private String languageOverride; + private boolean changingConfiguration = false; + + public static class LocaleInfo { + public String name; + public String nameEnglish; + public String shortName; + } + + public ArrayList sortedLanguages = new ArrayList(); + public HashMap languagesDict = new HashMap(); private static volatile LocaleController Instance = null; public static LocaleController getInstance() { @@ -34,24 +65,138 @@ public class LocaleController { } public LocaleController() { - currentLocale = Locale.getDefault(); - currentLanguage = currentLocale.getLanguage(); + LocaleController.LocaleInfo localeInfo = new LocaleController.LocaleInfo(); + localeInfo.name = "English"; + localeInfo.nameEnglish = "English"; + localeInfo.shortName = "en"; + sortedLanguages.add(localeInfo); + languagesDict.put(localeInfo.shortName, localeInfo); + + localeInfo = new LocaleController.LocaleInfo(); + localeInfo.name = "Italiano"; + localeInfo.nameEnglish = "Italian"; + localeInfo.shortName = "it"; + sortedLanguages.add(localeInfo); + languagesDict.put(localeInfo.shortName, localeInfo); + + localeInfo = new LocaleController.LocaleInfo(); + localeInfo.name = "Español"; + localeInfo.nameEnglish = "Spanish"; + localeInfo.shortName = "es"; + sortedLanguages.add(localeInfo); + languagesDict.put(localeInfo.shortName, localeInfo); + + localeInfo = new LocaleController.LocaleInfo(); + localeInfo.name = "Deutsch"; + localeInfo.nameEnglish = "German"; + localeInfo.shortName = "de"; + sortedLanguages.add(localeInfo); + languagesDict.put(localeInfo.shortName, localeInfo); + + localeInfo = new LocaleController.LocaleInfo(); + localeInfo.name = "Nederlands"; + localeInfo.nameEnglish = "Dutch"; + localeInfo.shortName = "nl"; + sortedLanguages.add(localeInfo); + languagesDict.put(localeInfo.shortName, localeInfo); + + localeInfo = new LocaleController.LocaleInfo(); + localeInfo.name = "العربية"; + localeInfo.nameEnglish = "Arabic"; + localeInfo.shortName = "ar"; + sortedLanguages.add(localeInfo); + languagesDict.put(localeInfo.shortName, localeInfo); + + Collections.sort(sortedLanguages, new Comparator() { + @Override + public int compare(LocaleController.LocaleInfo o, LocaleController.LocaleInfo o2) { + return o.name.compareTo(o2.name); + } + }); + + localeInfo = new LocaleController.LocaleInfo(); + localeInfo.name = "System default"; + localeInfo.nameEnglish = "System default"; + localeInfo.shortName = null; + sortedLanguages.add(0, localeInfo); + + systemDefaultLocale = Locale.getDefault(); + LocaleInfo currentInfo = null; + boolean override = false; + + try { + SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE); + String lang = preferences.getString("language", null); + if (lang != null) { + currentInfo = languagesDict.get(lang); + if (currentInfo != null) { + override = true; + } + } + + if (currentInfo == null && systemDefaultLocale.getLanguage() != null) { + currentInfo = languagesDict.get(systemDefaultLocale.getLanguage()); + } + if (currentInfo == null) { + currentInfo = languagesDict.get("en"); + } + applyLanguage(currentInfo, override); + } catch (Exception e) { + FileLog.e("tmessages", e); + } } - public void applyLanguage(String language) { - if (language != null) { - currentLanguage = language; - currentLocale = new Locale(currentLanguage); - } else { - currentLocale = Locale.getDefault(); - currentLanguage = currentLocale.getLanguage(); + public void applyLanguage(LocaleInfo localeInfo, boolean override) { + if (localeInfo == null) { + return; } + try { + Locale newLocale = null; + if (localeInfo.shortName != null) { + newLocale = new Locale(localeInfo.shortName); + if (newLocale != null) { + if (override) { + languageOverride = localeInfo.shortName; + + SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE); + SharedPreferences.Editor editor = preferences.edit(); + editor.putString("language", localeInfo.shortName); + editor.commit(); + } + } + } else { + newLocale = systemDefaultLocale; + languageOverride = null; + SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE); + SharedPreferences.Editor editor = preferences.edit(); + editor.remove("language"); + editor.commit(); + } + if (newLocale != null) { + currentLocale = newLocale; + currentLocaleInfo = localeInfo; + changingConfiguration = true; + Locale.setDefault(currentLocale); + android.content.res.Configuration config = new android.content.res.Configuration(); + config.locale = currentLocale; + ApplicationLoader.applicationContext.getResources().updateConfiguration(config, ApplicationLoader.applicationContext.getResources().getDisplayMetrics()); + changingConfiguration = false; + } + } catch (Exception e) { + FileLog.e("tmessages", e); + changingConfiguration = false; + } + recreateFormatters(); } private void loadCurrentLocale() { localeValues.clear(); } + public static String getCurrentLanguageName() { + return getString("LanguangeName", R.string.LanguangeName); + } + public static String getString(String key, int res) { String value = getInstance().localeValues.get(key); if (value == null) { @@ -76,4 +221,142 @@ public class LocaleController { return "LOC_ERR: " + key; } } + + public void onDeviceConfigurationChange(Configuration newConfig) { + if (changingConfiguration) { + return; + } + systemDefaultLocale = newConfig.locale; + if (languageOverride != null) { + LocaleInfo toSet = currentLocaleInfo; + currentLocaleInfo = null; + applyLanguage(toSet, false); + } else { + Locale newLocale = newConfig.locale; + if (newLocale != null) { + String d1 = newLocale.getDisplayName(); + String d2 = currentLocale.getDisplayName(); + if (d1 != null && d2 != null && !d1.equals(d2)) { + recreateFormatters(); + } + currentLocale = newLocale; + } + } + } + + public static String formatDateChat(long date) { + Calendar rightNow = Calendar.getInstance(); + int year = rightNow.get(Calendar.YEAR); + + rightNow.setTimeInMillis(date * 1000); + int dateYear = rightNow.get(Calendar.YEAR); + + if (year == dateYear) { + return chatDate.format(date * 1000); + } + return chatFullDate.format(date * 1000); + } + + public static String formatDate(long date) { + Calendar rightNow = Calendar.getInstance(); + int day = rightNow.get(Calendar.DAY_OF_YEAR); + int year = rightNow.get(Calendar.YEAR); + rightNow.setTimeInMillis(date * 1000); + int dateDay = rightNow.get(Calendar.DAY_OF_YEAR); + int dateYear = rightNow.get(Calendar.YEAR); + + if (dateDay == day && year == dateYear) { + return formatterDay.format(new Date(date * 1000)); + } else if (dateDay + 1 == day && year == dateYear) { + return ApplicationLoader.applicationContext.getResources().getString(R.string.Yesterday); + } else if (year == dateYear) { + return formatterMonth.format(new Date(date * 1000)); + } else { + return formatterYear.format(new Date(date * 1000)); + } + } + + public static String formatDateOnline(long date) { + Calendar rightNow = Calendar.getInstance(); + int day = rightNow.get(Calendar.DAY_OF_YEAR); + int year = rightNow.get(Calendar.YEAR); + rightNow.setTimeInMillis(date * 1000); + int dateDay = rightNow.get(Calendar.DAY_OF_YEAR); + int dateYear = rightNow.get(Calendar.YEAR); + + if (dateDay == day && year == dateYear) { + return String.format("%s %s %s", LocaleController.getString("LastSeen", R.string.LastSeen), LocaleController.getString("TodayAt", R.string.TodayAt), formatterDay.format(new Date(date * 1000))); + } else if (dateDay + 1 == day && year == dateYear) { + return String.format("%s %s %s", LocaleController.getString("LastSeen", R.string.LastSeen), LocaleController.getString("YesterdayAt", R.string.YesterdayAt), formatterDay.format(new Date(date * 1000))); + } else if (year == dateYear) { + return String.format("%s %s %s %s", LocaleController.getString("LastSeenDate", R.string.LastSeenDate), formatterMonth.format(new Date(date * 1000)), LocaleController.getString("OtherAt", R.string.OtherAt), formatterDay.format(new Date(date * 1000))); + } else { + return String.format("%s %s %s %s", LocaleController.getString("LastSeenDate", R.string.LastSeenDate), formatterYear.format(new Date(date * 1000)), LocaleController.getString("OtherAt", R.string.OtherAt), formatterDay.format(new Date(date * 1000))); + } + } + + public static void recreateFormatters() { + Locale locale = Locale.getDefault(); + String lang = locale.getLanguage(); + if (lang == null) { + lang = "en"; + } + isRTL = lang.toLowerCase().equals("ar"); + if (lang.equals("en")) { + formatterMonth = FastDateFormat.getInstance("MMM dd", locale); + formatterYear = FastDateFormat.getInstance("dd.MM.yy", locale); + formatterYearMax = FastDateFormat.getInstance("dd.MM.yyyy", locale); + chatDate = FastDateFormat.getInstance("MMMM d", locale); + chatFullDate = FastDateFormat.getInstance("MMMM d, yyyy", locale); + } else if (lang.startsWith("es")) { + formatterMonth = FastDateFormat.getInstance("dd 'de' MMM", locale); + formatterYear = FastDateFormat.getInstance("dd.MM.yy", locale); + formatterYearMax = FastDateFormat.getInstance("dd.MM.yyyy", locale); + chatDate = FastDateFormat.getInstance("d 'de' MMMM", locale); + chatFullDate = FastDateFormat.getInstance("d 'de' MMMM 'de' yyyy", locale); + } else { + formatterMonth = FastDateFormat.getInstance("dd MMM", locale); + formatterYear = FastDateFormat.getInstance("dd.MM.yy", locale); + formatterYearMax = FastDateFormat.getInstance("dd.MM.yyyy", locale); + chatDate = FastDateFormat.getInstance("d MMMM", locale); + chatFullDate = FastDateFormat.getInstance("d MMMM yyyy", locale); + } + formatterWeek = FastDateFormat.getInstance("EEE", locale); + + if (lang != null) { + if (DateFormat.is24HourFormat(ApplicationLoader.applicationContext)) { + formatterDay = FastDateFormat.getInstance("HH:mm", locale); + } else { + if (lang.toLowerCase().equals("ar")) { + formatterDay = FastDateFormat.getInstance("h:mm a", locale); + } else { + formatterDay = FastDateFormat.getInstance("h:mm a", Locale.US); + } + } + } else { + formatterDay = FastDateFormat.getInstance("h:mm a", Locale.US); + } + } + + public static String stringForMessageListDate(long date) { + Calendar rightNow = Calendar.getInstance(); + int day = rightNow.get(Calendar.DAY_OF_YEAR); + int year = rightNow.get(Calendar.YEAR); + rightNow.setTimeInMillis(date * 1000); + int dateDay = rightNow.get(Calendar.DAY_OF_YEAR); + int dateYear = rightNow.get(Calendar.YEAR); + + if (year != dateYear) { + return formatterYear.format(new Date(date * 1000)); + } else { + int dayDiff = dateDay - day; + if(dayDiff == 0 || dayDiff == -1 && (int)(System.currentTimeMillis() / 1000) - date < 60 * 60 * 8) { + return formatterDay.format(new Date(date * 1000)); + } else if(dayDiff > -7 && dayDiff <= -1) { + return formatterWeek.format(new Date(date * 1000)); + } else { + return formatterMonth.format(new Date(date * 1000)); + } + } + } } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java index 3b4cbf11f..a71ef4b99 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java @@ -4344,7 +4344,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter } else if (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionUserUpdatedPhoto) { msg = LocaleController.formatString("NotificationContactNewPhoto", R.string.NotificationContactNewPhoto, Utilities.formatName(u.first_name, u.last_name)); } else if (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionLoginUnknownLocation) { - String date = String.format("%s %s %s", Utilities.formatterYear.format(((long)messageObject.messageOwner.date) * 1000), LocaleController.getString("OtherAt", R.string.OtherAt), Utilities.formatterDay.format(((long)messageObject.messageOwner.date) * 1000)); + String date = String.format("%s %s %s", LocaleController.formatterYear.format(((long)messageObject.messageOwner.date) * 1000), LocaleController.getString("OtherAt", R.string.OtherAt), LocaleController.formatterDay.format(((long)messageObject.messageOwner.date) * 1000)); msg = LocaleController.formatString("NotificationUnrecognizedDevice", R.string.NotificationUnrecognizedDevice, UserConfig.currentUser.first_name, date, messageObject.messageOwner.action.title, messageObject.messageOwner.action.address); } } else { diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesStorage.java b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesStorage.java index 3b0a37c19..446e37ae9 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesStorage.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesStorage.java @@ -62,6 +62,8 @@ public class MessagesStorage { } public void openDatabase() { + NativeLoader.initNativeLibs(ApplicationLoader.applicationContext); + cacheFile = new File(ApplicationLoader.applicationContext.getFilesDir(), "cache4.db"); SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("dbconfig", Context.MODE_PRIVATE); diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/NativeLoader.java b/TMessagesProj/src/main/java/org/telegram/messenger/NativeLoader.java index 2c00ee014..872d3e3db 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/NativeLoader.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/NativeLoader.java @@ -28,7 +28,13 @@ public class NativeLoader { 0, //mips }; - public static void initNativeLibs(Context context) { + private static volatile boolean nativeLoaded = false; + + public static synchronized void initNativeLibs(Context context) { + if (nativeLoaded) { + return; + } + if (Build.VERSION.SDK_INT >= 9) { try { String folder = null; @@ -50,6 +56,7 @@ public class NativeLoader { libSize = sizes[3]; } else { System.loadLibrary("tmessages"); + nativeLoaded = true; Log.e("tmessages", "Unsupported arch: " + Build.CPU_ABI); return; } @@ -59,6 +66,7 @@ public class NativeLoader { Log.d("tmessages", "Load normal lib"); try { System.loadLibrary("tmessages"); + nativeLoaded = true; return; } catch (Exception e) { e.printStackTrace(); @@ -68,9 +76,14 @@ public class NativeLoader { File destLocalFile = new File(context.getFilesDir().getAbsolutePath() + "/libtmessages.so"); if (destLocalFile.exists()) { if (destLocalFile.length() == libSize) { - Log.d("tmessages", "Load local lib"); - System.load(destLocalFile.getAbsolutePath()); - return; + try { + Log.d("tmessages", "Load local lib"); + System.load(destLocalFile.getAbsolutePath()); + nativeLoaded = true; + return; + } catch (Exception e) { + e.printStackTrace(); + } } else { destLocalFile.delete(); } @@ -98,6 +111,7 @@ public class NativeLoader { out.close(); System.load(destLocalFile.getAbsolutePath()); + nativeLoaded = true; return; } catch (Exception e) { e.printStackTrace(); @@ -123,5 +137,6 @@ public class NativeLoader { } System.loadLibrary("tmessages"); + nativeLoaded = true; } } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/TcpConnection.java b/TMessagesProj/src/main/java/org/telegram/messenger/TcpConnection.java index 65a414d53..c819424ce 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/TcpConnection.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/TcpConnection.java @@ -60,6 +60,7 @@ public class TcpConnection extends PyroClientAdapter { private boolean firstPacket; private Timer reconnectTimer; + private boolean tryWithNoNetworkAnyway = false; public TcpConnection(int did) { if (selector == null) { @@ -90,9 +91,13 @@ public class TcpConnection extends PyroClientAdapter { connectionState = TcpConnectionState.TcpConnectionStageConnecting; try { - if (!ConnectionsManager.isNetworkOnline()) { - handleConnectionError(null); - return; + if(android.os.Build.VERSION.SDK_INT < 11) { + if (!ConnectionsManager.isNetworkOnline() && !tryWithNoNetworkAnyway) { + handleConnectionError(null); + tryWithNoNetworkAnyway = true; + return; + } + tryWithNoNetworkAnyway = false; } try { synchronized (timerSync) { diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/Utilities.java b/TMessagesProj/src/main/java/org/telegram/messenger/Utilities.java index ae81c1602..f8ca9bc5a 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/Utilities.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/Utilities.java @@ -24,7 +24,6 @@ import android.provider.DocumentsContract; import android.provider.MediaStore; import android.text.Html; import android.text.SpannableStringBuilder; -import android.text.format.DateFormat; import android.util.Base64; import android.view.Display; import android.view.View; @@ -49,7 +48,6 @@ import java.security.PublicKey; import java.security.spec.RSAPublicKeySpec; import java.text.SimpleDateFormat; import java.util.ArrayList; -import java.util.Calendar; import java.util.Date; import java.util.Hashtable; import java.util.Locale; @@ -64,7 +62,6 @@ public class Utilities { public static int statusBarHeight = 0; public static float density = 1; public static Point displaySize = new Point(); - public static boolean isRTL = false; public static Pattern pattern = Pattern.compile("[0-9]+"); private final static Integer lock = 1; @@ -83,14 +80,6 @@ public class Utilities { public static volatile DispatchQueue imageLoadQueue = new DispatchQueue("imageLoadQueue"); public static volatile DispatchQueue fileUploadQueue = new DispatchQueue("fileUploadQueue"); - public static FastDateFormat formatterDay; - public static FastDateFormat formatterWeek; - public static FastDateFormat formatterMonth; - public static FastDateFormat formatterYear; - public static FastDateFormat formatterYearMax; - public static FastDateFormat chatDate; - public static FastDateFormat chatFullDate; - public static int[] arrColors = {0xffee4928, 0xff41a903, 0xffe09602, 0xff0f94ed, 0xff8f3bf7, 0xfffc4380, 0xff00a1c4, 0xffeb7002}; public static int[] arrUsersAvatars = { R.drawable.user_red, @@ -139,7 +128,6 @@ public class Utilities { } } - recreateFormatters(); checkDisplaySize(); } @@ -537,49 +525,6 @@ public class Utilities { }); } - public static void recreateFormatters() { - Locale locale = Locale.getDefault(); - String lang = locale.getLanguage(); - if (lang == null) { - lang = "en"; - } - isRTL = lang.toLowerCase().equals("ar"); - if (lang.equals("en")) { - formatterMonth = FastDateFormat.getInstance("MMM dd", locale); - formatterYear = FastDateFormat.getInstance("dd.MM.yy", locale); - formatterYearMax = FastDateFormat.getInstance("dd.MM.yyyy", locale); - chatDate = FastDateFormat.getInstance("MMMM d", locale); - chatFullDate = FastDateFormat.getInstance("MMMM d, yyyy", locale); - } else if (lang.startsWith("es")) { - formatterMonth = FastDateFormat.getInstance("dd 'de' MMM", locale); - formatterYear = FastDateFormat.getInstance("dd.MM.yy", locale); - formatterYearMax = FastDateFormat.getInstance("dd.MM.yyyy", locale); - chatDate = FastDateFormat.getInstance("d 'de' MMMM", locale); - chatFullDate = FastDateFormat.getInstance("d 'de' MMMM 'de' yyyy", locale); - } else { - formatterMonth = FastDateFormat.getInstance("dd MMM", locale); - formatterYear = FastDateFormat.getInstance("dd.MM.yy", locale); - formatterYearMax = FastDateFormat.getInstance("dd.MM.yyyy", locale); - chatDate = FastDateFormat.getInstance("d MMMM", locale); - chatFullDate = FastDateFormat.getInstance("d MMMM yyyy", locale); - } - formatterWeek = FastDateFormat.getInstance("EEE", locale); - - if (lang != null) { - if (DateFormat.is24HourFormat(ApplicationLoader.applicationContext)) { - formatterDay = FastDateFormat.getInstance("HH:mm", locale); - } else { - if (lang.toLowerCase().equals("ar")) { - formatterDay = FastDateFormat.getInstance("h:mm a", locale); - } else { - formatterDay = FastDateFormat.getInstance("h:mm a", Locale.US); - } - } - } else { - formatterDay = FastDateFormat.getInstance("h:mm a", Locale.US); - } - } - public static void checkDisplaySize() { try { WindowManager manager = (WindowManager)ApplicationLoader.applicationContext.getSystemService(Context.WINDOW_SERVICE); @@ -599,57 +544,6 @@ public class Utilities { } } - public static String formatDateChat(long date) { - Calendar rightNow = Calendar.getInstance(); - int year = rightNow.get(Calendar.YEAR); - - rightNow.setTimeInMillis(date * 1000); - int dateYear = rightNow.get(Calendar.YEAR); - - if (year == dateYear) { - return chatDate.format(date * 1000); - } - return chatFullDate.format(date * 1000); - } - - public static String formatDate(long date) { - Calendar rightNow = Calendar.getInstance(); - int day = rightNow.get(Calendar.DAY_OF_YEAR); - int year = rightNow.get(Calendar.YEAR); - rightNow.setTimeInMillis(date * 1000); - int dateDay = rightNow.get(Calendar.DAY_OF_YEAR); - int dateYear = rightNow.get(Calendar.YEAR); - - if (dateDay == day && year == dateYear) { - return formatterDay.format(new Date(date * 1000)); - } else if (dateDay + 1 == day && year == dateYear) { - return ApplicationLoader.applicationContext.getResources().getString(R.string.Yesterday); - } else if (year == dateYear) { - return formatterMonth.format(new Date(date * 1000)); - } else { - return formatterYear.format(new Date(date * 1000)); - } - } - - public static String formatDateOnline(long date) { - Calendar rightNow = Calendar.getInstance(); - int day = rightNow.get(Calendar.DAY_OF_YEAR); - int year = rightNow.get(Calendar.YEAR); - rightNow.setTimeInMillis(date * 1000); - int dateDay = rightNow.get(Calendar.DAY_OF_YEAR); - int dateYear = rightNow.get(Calendar.YEAR); - - if (dateDay == day && year == dateYear) { - return String.format("%s %s %s", LocaleController.getString("LastSeen", R.string.LastSeen), LocaleController.getString("TodayAt", R.string.TodayAt), formatterDay.format(new Date(date * 1000))); - } else if (dateDay + 1 == day && year == dateYear) { - return String.format("%s %s %s", LocaleController.getString("LastSeen", R.string.LastSeen), LocaleController.getString("YesterdayAt", R.string.YesterdayAt), formatterDay.format(new Date(date * 1000))); - } else if (year == dateYear) { - return String.format("%s %s %s %s", LocaleController.getString("LastSeenDate", R.string.LastSeenDate), formatterMonth.format(new Date(date * 1000)), LocaleController.getString("OtherAt", R.string.OtherAt), formatterDay.format(new Date(date * 1000))); - } else { - return String.format("%s %s %s %s", LocaleController.getString("LastSeenDate", R.string.LastSeenDate), formatterYear.format(new Date(date * 1000)), LocaleController.getString("OtherAt", R.string.OtherAt), formatterDay.format(new Date(date * 1000))); - } - } - public static void HideProgressDialog(Activity activity) { activity.runOnUiThread(new Runnable() { @Override @@ -941,7 +835,7 @@ public class Utilities { } else if (result.length() != 0 && lastName.length() != 0) { result += " " + lastName; } - return result; + return result.trim(); } public static String formatFileSize(long size) { @@ -956,28 +850,6 @@ public class Utilities { } } - public static String stringForMessageListDate(long date) { - Calendar rightNow = Calendar.getInstance(); - int day = rightNow.get(Calendar.DAY_OF_YEAR); - int year = rightNow.get(Calendar.YEAR); - rightNow.setTimeInMillis(date * 1000); - int dateDay = rightNow.get(Calendar.DAY_OF_YEAR); - int dateYear = rightNow.get(Calendar.YEAR); - - if (year != dateYear) { - return formatterYear.format(new Date(date * 1000)); - } else { - int dayDiff = dateDay - day; - if(dayDiff == 0 || dayDiff == -1 && (int)(System.currentTimeMillis() / 1000) - date < 60 * 60 * 8) { - return formatterDay.format(new Date(date * 1000)); - } else if(dayDiff > -7 && dayDiff <= -1) { - return formatterWeek.format(new Date(date * 1000)); - } else { - return formatterMonth.format(new Date(date * 1000)); - } - } - } - public static byte[] decodeQuotedPrintable(final byte[] bytes) { if (bytes == null) { return null; diff --git a/TMessagesProj/src/main/java/org/telegram/objects/MessageObject.java b/TMessagesProj/src/main/java/org/telegram/objects/MessageObject.java index c5e0ed639..31ac47dff 100644 --- a/TMessagesProj/src/main/java/org/telegram/objects/MessageObject.java +++ b/TMessagesProj/src/main/java/org/telegram/objects/MessageObject.java @@ -202,7 +202,7 @@ public class MessageObject { } } } else if (message.action instanceof TLRPC.TL_messageActionLoginUnknownLocation) { - String date = String.format("%s %s %s", Utilities.formatterYear.format(((long)message.date) * 1000), LocaleController.getString("OtherAt", R.string.OtherAt), Utilities.formatterDay.format(((long)message.date) * 1000)); + String date = String.format("%s %s %s", LocaleController.formatterYear.format(((long)message.date) * 1000), LocaleController.getString("OtherAt", R.string.OtherAt), LocaleController.formatterDay.format(((long)message.date) * 1000)); messageText = LocaleController.formatString("NotificationUnrecognizedDevice", R.string.NotificationUnrecognizedDevice, UserConfig.currentUser.first_name, date, message.action.title, message.action.address); } else if (message.action instanceof TLRPC.TL_messageActionUserJoined) { if (fromUser != null) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Adapters/ContactsActivityAdapter.java b/TMessagesProj/src/main/java/org/telegram/ui/Adapters/ContactsActivityAdapter.java index d46c49827..f341e93af 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Adapters/ContactsActivityAdapter.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Adapters/ContactsActivityAdapter.java @@ -9,7 +9,6 @@ package org.telegram.ui.Adapters; import android.content.Context; -import android.text.Html; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -114,7 +113,6 @@ public class ContactsActivityAdapter extends SectionedBaseAdapter { if (user != null) { if (convertView == null) { convertView = new ChatOrUserCell(mContext); - ((ChatOrUserCell)convertView).useBoldFont = true; ((ChatOrUserCell)convertView).usePadding = false; } @@ -153,11 +151,11 @@ public class ContactsActivityAdapter extends SectionedBaseAdapter { } } if (contact.first_name != null && contact.last_name != null) { - textView.setText(Html.fromHtml(contact.first_name + " " + contact.last_name + "")); + textView.setText(contact.first_name + " " + contact.last_name); } else if (contact.first_name != null && contact.last_name == null) { - textView.setText(Html.fromHtml("" + contact.first_name + "")); + textView.setText(contact.first_name); } else { - textView.setText(Html.fromHtml("" + contact.last_name + "")); + textView.setText(contact.last_name); } return convertView; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Adapters/ContactsActivitySearchAdapter.java b/TMessagesProj/src/main/java/org/telegram/ui/Adapters/ContactsActivitySearchAdapter.java index 7b721e16a..2c2bb6189 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Adapters/ContactsActivitySearchAdapter.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Adapters/ContactsActivitySearchAdapter.java @@ -30,7 +30,7 @@ public class ContactsActivitySearchAdapter extends BaseFragmentAdapter { private HashMap ignoreUsers; private ArrayList searchResult; private ArrayList searchResultNames; - private Timer searchDialogsTimer; + private Timer searchTimer; public ContactsActivitySearchAdapter(Context context, HashMap arg1) { mContext = context; @@ -44,19 +44,19 @@ public class ContactsActivitySearchAdapter extends BaseFragmentAdapter { notifyDataSetChanged(); } else { try { - if (searchDialogsTimer != null) { - searchDialogsTimer.cancel(); + if (searchTimer != null) { + searchTimer.cancel(); } } catch (Exception e) { FileLog.e("tmessages", e); } - searchDialogsTimer = new Timer(); - searchDialogsTimer.schedule(new TimerTask() { + searchTimer = new Timer(); + searchTimer.schedule(new TimerTask() { @Override public void run() { try { - searchDialogsTimer.cancel(); - searchDialogsTimer = null; + searchTimer.cancel(); + searchTimer = null; } catch (Exception e) { FileLog.e("tmessages", e); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ApplicationLoader.java b/TMessagesProj/src/main/java/org/telegram/ui/ApplicationLoader.java index 32b6370ea..4d947129d 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ApplicationLoader.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ApplicationLoader.java @@ -30,6 +30,7 @@ import com.google.android.gms.gcm.GoogleCloudMessaging; import org.telegram.messenger.BuildVars; import org.telegram.messenger.ConnectionsManager; import org.telegram.messenger.FileLog; +import org.telegram.messenger.LocaleController; import org.telegram.messenger.MessagesController; import org.telegram.messenger.NativeLoader; import org.telegram.messenger.ScreenReceiver; @@ -39,7 +40,6 @@ import org.telegram.ui.Views.BaseFragment; import java.lang.reflect.Field; import java.util.ArrayList; -import java.util.Locale; import java.util.concurrent.atomic.AtomicInteger; public class ApplicationLoader extends Application { @@ -52,7 +52,6 @@ public class ApplicationLoader extends Application { private static final int PLAY_SERVICES_RESOLUTION_REQUEST = 9000; public static long lastPauseTime; public static Bitmap cachedWallpaper = null; - private Locale currentLocale; public static volatile Context applicationContext = null; public static volatile Handler applicationHandler = null; @@ -120,8 +119,14 @@ public class ApplicationLoader extends Application { super.onCreate(); lastPauseTime = System.currentTimeMillis(); applicationContext = getApplicationContext(); + NativeLoader.initNativeLibs(this); + try { + LocaleController.getInstance(); + } catch (Exception e) { + e.printStackTrace(); + } + applicationHandler = new Handler(applicationContext.getMainLooper()); - currentLocale = Locale.getDefault(); java.lang.System.setProperty("java.net.preferIPv4Stack", "true"); java.lang.System.setProperty("java.net.preferIPv6Addresses", "false"); @@ -136,23 +141,17 @@ public class ApplicationLoader extends Application { } catch (Exception e) { e.printStackTrace(); } - - FileLog.e("tmessages", "start application with time " + lastPauseTime); } @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); - Locale newLocale = newConfig.locale; - if (newLocale != null) { - String d1 = newLocale.getDisplayName(); - String d2 = currentLocale.getDisplayName(); - if (d1 != null && d2 != null && !d1.equals(d2)) { - Utilities.recreateFormatters(); - } - currentLocale = newLocale; + try { + LocaleController.getInstance().onDeviceConfigurationChange(newConfig); + Utilities.checkDisplaySize(); + } catch (Exception e) { + e.printStackTrace(); } - Utilities.checkDisplaySize(); } public static void resetLastPauseTime() { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatBaseCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatBaseCell.java index 84dc170e8..c5b4e94cc 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatBaseCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatBaseCell.java @@ -206,7 +206,7 @@ public class ChatBaseCell extends BaseCell { currentTimePaint = timePaintIn; } - currentTimeString = Utilities.formatterDay.format((long) (currentMessageObject.messageOwner.date) * 1000); + currentTimeString = LocaleController.formatterDay.format((long) (currentMessageObject.messageOwner.date) * 1000); timeWidth = (int)Math.ceil(currentTimePaint.measureText(currentTimeString)); namesOffset = 0; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatOrUserCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatOrUserCell.java index bbab9c69e..3d8f526ae 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatOrUserCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatOrUserCell.java @@ -12,7 +12,6 @@ import android.content.Context; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.drawable.Drawable; -import android.text.Html; import android.text.Layout; import android.text.StaticLayout; import android.text.TextPaint; @@ -55,7 +54,6 @@ public class ChatOrUserCell extends BaseCell { private TLRPC.FileLocation lastAvatar = null; public boolean usePadding = true; - public boolean useBoldFont = false; public boolean useSeparator = false; public float drawAlpha = 1; @@ -275,7 +273,7 @@ public class ChatOrUserCell extends BaseCell { if (encryptedChat != null) { drawNameLock = true; - if (!Utilities.isRTL) { + if (!LocaleController.isRTL) { nameLockLeft = Utilities.dp(61 + (usePadding ? 11 : 0)); nameLeft = Utilities.dp(65 + (usePadding ? 11 : 0)) + lockDrawable.getIntrinsicWidth(); } else { @@ -284,7 +282,7 @@ public class ChatOrUserCell extends BaseCell { } } else { drawNameLock = false; - if (!Utilities.isRTL) { + if (!LocaleController.isRTL) { nameLeft = Utilities.dp(61 + (usePadding ? 11 : 0)); } else { nameLeft = usePadding ? Utilities.dp(11) : 0; @@ -294,39 +292,30 @@ public class ChatOrUserCell extends BaseCell { if (currentName != null) { nameString = currentName; } else { - if (useBoldFont) { - if (user != null) { - if (user.first_name.length() != 0 && user.last_name.length() != 0) { - nameString = Html.fromHtml(user.first_name + " " + user.last_name + ""); - } else if (user.first_name.length() != 0) { - nameString = Html.fromHtml("" + user.first_name + ""); - } else { - nameString = Html.fromHtml("" + user.last_name + ""); - } - } - } else { - String nameString2 = ""; - if (chat != null) { - nameString2 = chat.title; - } else if (user != null) { - if (user.id / 1000 != 333 && ContactsController.getInstance().contactsDict.get(user.id) == null) { - if (ContactsController.getInstance().contactsDict.size() == 0 && ContactsController.getInstance().loadingContacts) { - nameString2 = Utilities.formatName(user.first_name, user.last_name); - } else { - if (user.phone != null && user.phone.length() != 0) { - nameString2 = PhoneFormat.getInstance().format("+" + user.phone); - } else { - nameString2 = Utilities.formatName(user.first_name, user.last_name); - } - } - } else { + String nameString2 = ""; + if (chat != null) { + nameString2 = chat.title; + } else if (user != null) { + if (user.id / 1000 != 333 && ContactsController.getInstance().contactsDict.get(user.id) == null) { + if (ContactsController.getInstance().contactsDict.size() == 0 && ContactsController.getInstance().loadingContacts) { nameString2 = Utilities.formatName(user.first_name, user.last_name); + } else { + if (user.phone != null && user.phone.length() != 0) { + nameString2 = PhoneFormat.getInstance().format("+" + user.phone); + } else { + nameString2 = Utilities.formatName(user.first_name, user.last_name); + } } + } else { + nameString2 = Utilities.formatName(user.first_name, user.last_name); } - nameString = nameString2.replace("\n", " "); } + nameString = nameString2.replace("\n", " "); } if (nameString.length() == 0) { + if (user.phone != null && user.phone.length() != 0) { + nameString = PhoneFormat.getInstance().format("+" + user.phone); + } nameString = LocaleController.getString("HiddenName", R.string.HiddenName); } if (encryptedChat != null) { @@ -335,7 +324,7 @@ public class ChatOrUserCell extends BaseCell { currentNamePaint = namePaint; } - if (!Utilities.isRTL) { + if (!LocaleController.isRTL) { onlineWidth = nameWidth = width - nameLeft - Utilities.dp(3 + (usePadding ? 11 : 0)); } else { onlineWidth = nameWidth = width - nameLeft - Utilities.dp(61 + (usePadding ? 11 : 0)); @@ -348,7 +337,7 @@ public class ChatOrUserCell extends BaseCell { nameLayout = new StaticLayout(nameStringFinal, currentNamePaint, nameWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false); if (chat == null) { - if (!Utilities.isRTL) { + if (!LocaleController.isRTL) { onlineLeft = Utilities.dp(61 + (usePadding ? 11 : 0)); } else { onlineLeft = usePadding ? Utilities.dp(11) : 0; @@ -372,7 +361,7 @@ public class ChatOrUserCell extends BaseCell { if (user.status.expires <= 10000) { onlineString = getResources().getString(R.string.Invisible); } else { - onlineString = Utilities.formatDateOnline(user.status.expires); + onlineString = LocaleController.formatDateOnline(user.status.expires); } } } @@ -387,7 +376,7 @@ public class ChatOrUserCell extends BaseCell { nameTop = Utilities.dp(22); } - if (!Utilities.isRTL) { + if (!LocaleController.isRTL) { avatarLeft = usePadding ? Utilities.dp(11) : 0; } else { avatarLeft = width - Utilities.dp(50 + (usePadding ? 11 : 0)); @@ -399,7 +388,7 @@ public class ChatOrUserCell extends BaseCell { double widthpx = 0; float left = 0; - if (Utilities.isRTL) { + if (LocaleController.isRTL) { if (nameLayout.getLineCount() > 0) { left = nameLayout.getLineLeft(0); if (left == 0) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogCell.java index 3fe02930a..7662ea06a 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogCell.java @@ -359,7 +359,7 @@ public class DialogCell extends BaseCell { if (encryptedChat != null) { drawNameLock = true; - if (!Utilities.isRTL) { + if (!LocaleController.isRTL) { nameLockLeft = Utilities.dp(77); nameLeft = Utilities.dp(81) + lockDrawable.getIntrinsicWidth(); } else { @@ -368,7 +368,7 @@ public class DialogCell extends BaseCell { } } else { drawNameLock = false; - if (!Utilities.isRTL) { + if (!LocaleController.isRTL) { nameLeft = Utilities.dp(77); } else { nameLeft = Utilities.dp(14); @@ -407,7 +407,7 @@ public class DialogCell extends BaseCell { } } if (currentDialog.last_message_date != 0) { - timeString = Utilities.stringForMessageListDate(currentDialog.last_message_date); + timeString = LocaleController.stringForMessageListDate(currentDialog.last_message_date); } drawCheck1 = false; drawCheck2 = false; @@ -418,9 +418,9 @@ public class DialogCell extends BaseCell { TLRPC.User fromUser = MessagesController.getInstance().users.get(message.messageOwner.from_id); if (currentDialog.last_message_date != 0) { - timeString = Utilities.stringForMessageListDate(currentDialog.last_message_date); + timeString = LocaleController.stringForMessageListDate(currentDialog.last_message_date); } else { - timeString = Utilities.stringForMessageListDate(message.messageOwner.date); + timeString = LocaleController.stringForMessageListDate(message.messageOwner.date); } if (printingString != null) { lastPrintString = messageString = printingString; @@ -508,7 +508,7 @@ public class DialogCell extends BaseCell { timeWidth = (int)Math.ceil(timePaint.measureText(timeString)); timeLayout = new StaticLayout(timeString, timePaint, timeWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false); - if (!Utilities.isRTL) { + if (!LocaleController.isRTL) { timeLeft = width - Utilities.dp(11) - timeWidth; } else { timeLeft = Utilities.dp(11); @@ -539,7 +539,7 @@ public class DialogCell extends BaseCell { nameString = LocaleController.getString("HiddenName", R.string.HiddenName); } - if (!Utilities.isRTL) { + if (!LocaleController.isRTL) { nameWidth = width - nameLeft - Utilities.dp(14) - timeWidth; } else { nameWidth = width - nameLeft - Utilities.dp(77) - timeWidth; @@ -551,7 +551,7 @@ public class DialogCell extends BaseCell { if (drawClock) { int w = clockDrawable.getIntrinsicWidth() + Utilities.dp(2); nameWidth -= w; - if (!Utilities.isRTL) { + if (!LocaleController.isRTL) { checkDrawLeft = timeLeft - w; } else { checkDrawLeft = timeLeft + timeWidth + Utilities.dp(2); @@ -562,7 +562,7 @@ public class DialogCell extends BaseCell { nameWidth -= w; if (drawCheck1) { nameWidth -= halfCheckDrawable.getIntrinsicWidth() - Utilities.dp(5); - if (!Utilities.isRTL) { + if (!LocaleController.isRTL) { halfCheckDrawLeft = timeLeft - w; checkDrawLeft = halfCheckDrawLeft - Utilities.dp(5); } else { @@ -571,7 +571,7 @@ public class DialogCell extends BaseCell { nameLeft += w + halfCheckDrawable.getIntrinsicWidth() - Utilities.dp(5); } } else { - if (!Utilities.isRTL) { + if (!LocaleController.isRTL) { checkDrawLeft = timeLeft - w; } else { checkDrawLeft = timeLeft + timeWidth + Utilities.dp(2); @@ -584,7 +584,7 @@ public class DialogCell extends BaseCell { nameLayout = new StaticLayout(nameStringFinal, currentNamePaint, nameWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false); messageWidth = width - Utilities.dp(88); - if (!Utilities.isRTL) { + if (!LocaleController.isRTL) { messageLeft = Utilities.dp(77); avatarLeft = Utilities.dp(11); } else { @@ -598,7 +598,7 @@ public class DialogCell extends BaseCell { if (drawError) { int w = errorDrawable.getIntrinsicWidth() + Utilities.dp(8); messageWidth -= w; - if (!Utilities.isRTL) { + if (!LocaleController.isRTL) { errorLeft = width - errorDrawable.getIntrinsicWidth() - Utilities.dp(11); } else { errorLeft = Utilities.dp(11); @@ -609,7 +609,7 @@ public class DialogCell extends BaseCell { countLayout = new StaticLayout(countString, countPaint, countWidth, Layout.Alignment.ALIGN_CENTER, 1.0f, 0.0f, false); int w = countWidth + Utilities.dp(18); messageWidth -= w; - if (!Utilities.isRTL) { + if (!LocaleController.isRTL) { countLeft = width - countWidth - Utilities.dp(16); } else { countLeft = Utilities.dp(16); @@ -636,7 +636,7 @@ public class DialogCell extends BaseCell { double widthpx = 0; float left = 0; - if (Utilities.isRTL) { + if (LocaleController.isRTL) { if (nameLayout.getLineCount() > 0) { left = nameLayout.getLineLeft(0); if (left == 0) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java index 920c4b74e..2a4eabbd5 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java @@ -1315,7 +1315,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa if (currentUser.status.expires <= 10000) { actionBar.setSubtitle(LocaleController.getString("Invisible", R.string.Invisible)); } else { - actionBar.setSubtitle(Utilities.formatDateOnline(currentUser.status.expires)); + actionBar.setSubtitle(LocaleController.formatDateOnline(currentUser.status.expires)); } } } @@ -1624,7 +1624,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa messagesByDays.put(obj.dateKey, dayArray); TLRPC.Message dateMsg = new TLRPC.Message(); - dateMsg.message = Utilities.formatDateChat(obj.messageOwner.date); + dateMsg.message = LocaleController.formatDateChat(obj.messageOwner.date); dateMsg.id = 0; MessageObject dateObj = new MessageObject(dateMsg, null); dateObj.type = 10; @@ -1902,7 +1902,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa messagesByDays.put(obj.dateKey, dayArray); TLRPC.Message dateMsg = new TLRPC.Message(); - dateMsg.message = Utilities.formatDateChat(obj.messageOwner.date); + dateMsg.message = LocaleController.formatDateChat(obj.messageOwner.date); dateMsg.id = 0; MessageObject dateObj = new MessageObject(dateMsg, null); dateObj.type = 10; @@ -3557,7 +3557,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa int type = message.type; if (timeTextView != null) { - timeTextView.setText(Utilities.formatterDay.format((long) (message.messageOwner.date) * 1000)); + timeTextView.setText(LocaleController.formatterDay.format((long) (message.messageOwner.date) * 1000)); } if (avatarImageView != null && fromUser != null) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatProfileActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatProfileActivity.java index 726a118c8..0d845f2b0 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatProfileActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatProfileActivity.java @@ -684,7 +684,6 @@ public class ChatProfileActivity extends BaseFragment implements NotificationCen if (view == null) { view = new ChatOrUserCell(mContext); - ((ChatOrUserCell)view).useBoldFont = true; ((ChatOrUserCell)view).usePadding = false; ((ChatOrUserCell)view).useSeparator = true; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ContactAddActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ContactAddActivity.java index c9917c458..de76abda3 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ContactAddActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ContactAddActivity.java @@ -141,7 +141,7 @@ public class ContactAddActivity extends BaseFragment implements NotificationCent if (user.status.expires <= 10000) { onlineText.setText(LocaleController.getString("Invisible", R.string.Invisible)); } else { - onlineText.setText(Utilities.formatDateOnline(user.status.expires)); + onlineText.setText(LocaleController.formatDateOnline(user.status.expires)); } } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ContactsActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ContactsActivity.java index 46e43ccc3..61d29c263 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ContactsActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ContactsActivity.java @@ -70,7 +70,7 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter public int selectAlertString = 0; public String selectAlertStringDesc = null; private SearchView searchView; - private TextView epmtyTextView; + private TextView emptyTextView; private HashMap ignoreUsers; private SupportMenuItem searchItem; @@ -145,12 +145,12 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter fragmentView = inflater.inflate(R.layout.contacts_layout, container, false); - epmtyTextView = (TextView)fragmentView.findViewById(R.id.searchEmptyView); - epmtyTextView.setText(LocaleController.getString("NoContacts", R.string.NoContacts)); + emptyTextView = (TextView)fragmentView.findViewById(R.id.searchEmptyView); + emptyTextView.setText(LocaleController.getString("NoContacts", R.string.NoContacts)); searchListViewAdapter = new ContactsActivitySearchAdapter(parentActivity, ignoreUsers); listView = (PinnedHeaderListView)fragmentView.findViewById(R.id.listView); - listView.setEmptyView(epmtyTextView); + listView.setEmptyView(emptyTextView); listView.setVerticalScrollBarEnabled(false); listViewAdapter = new ContactsActivityAdapter(parentActivity, onlyUsers, usersAsSections, ignoreUsers); @@ -284,7 +284,7 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter } } }); - epmtyTextView.setOnTouchListener(new OnSwipeTouchListener() { + emptyTextView.setOnTouchListener(new OnSwipeTouchListener() { public void onSwipeRight() { finishFragment(true); if (searchItem != null) { @@ -444,8 +444,8 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter listView.setFastScrollEnabled(false); listView.setVerticalScrollBarEnabled(true); } - if (epmtyTextView != null) { - epmtyTextView.setText(LocaleController.getString("NoResult", R.string.NoResult)); + if (emptyTextView != null) { + emptyTextView.setText(LocaleController.getString("NoResult", R.string.NoResult)); } } return true; @@ -474,7 +474,7 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter searchWas = false; ViewGroup group = (ViewGroup) listView.getParent(); listView.setAdapter(listViewAdapter); - if (!Utilities.isRTL) { + if (!LocaleController.isRTL) { listView.setPadding(Utilities.dp(16), listView.getPaddingTop(), Utilities.dp(30), listView.getPaddingBottom()); } else { listView.setPadding(Utilities.dp(30), listView.getPaddingTop(), Utilities.dp(16), listView.getPaddingBottom()); @@ -486,7 +486,7 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter listView.setVerticalScrollBarEnabled(false); ((LaunchActivity)parentActivity).updateActionBar(); - epmtyTextView.setText(LocaleController.getString("NoContacts", R.string.NoContacts)); + emptyTextView.setText(LocaleController.getString("NoContacts", R.string.NoContacts)); return true; } }); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/CountrySelectActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/CountrySelectActivity.java index b3edd663e..1c914a0d4 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/CountrySelectActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/CountrySelectActivity.java @@ -29,6 +29,7 @@ import android.widget.ImageView; import android.widget.TextView; import org.telegram.messenger.FileLog; +import org.telegram.messenger.LocaleController; import org.telegram.messenger.R; import org.telegram.messenger.Utilities; import org.telegram.ui.Views.PinnedHeaderListView; @@ -52,11 +53,11 @@ public class CountrySelectActivity extends ActionBarActivity { private boolean searchWas; private boolean searching; private BaseAdapter searchListViewAdapter; - private TextView epmtyTextView; + private TextView emptyTextView; private HashMap> countries = new HashMap>(); private ArrayList sortedCountries = new ArrayList(); - private Timer searchDialogsTimer; + private Timer searchTimer; public ArrayList searchResult; public static class Country { @@ -112,11 +113,11 @@ public class CountrySelectActivity extends ActionBarActivity { setContentView(R.layout.country_select_layout); - epmtyTextView = (TextView)findViewById(R.id.searchEmptyView); + emptyTextView = (TextView)findViewById(R.id.searchEmptyView); searchListViewAdapter = new SearchAdapter(this); listView = (PinnedHeaderListView)findViewById(R.id.listView); - listView.setEmptyView(epmtyTextView); + listView.setEmptyView(emptyTextView); listView.setVerticalScrollBarEnabled(false); listView.setAdapter(listViewAdapter = new ListAdapter(this)); @@ -221,7 +222,7 @@ public class CountrySelectActivity extends ActionBarActivity { @Override public boolean onQueryTextChange(String s) { - searchDialogs(s); + search(s); if (s.length() != 0) { searchWas = true; if (listView != null) { @@ -233,8 +234,8 @@ public class CountrySelectActivity extends ActionBarActivity { listView.setFastScrollEnabled(false); listView.setVerticalScrollBarEnabled(true); } - if (epmtyTextView != null) { - epmtyTextView.setText(getString(R.string.NoResult)); + if (emptyTextView != null) { + emptyTextView.setText(getString(R.string.NoResult)); } } return true; @@ -252,12 +253,12 @@ public class CountrySelectActivity extends ActionBarActivity { @Override public boolean onMenuItemActionCollapse(MenuItem menuItem) { searchView.setQuery("", false); - searchDialogs(null); + search(null); searching = false; searchWas = false; ViewGroup group = (ViewGroup) listView.getParent(); listView.setAdapter(listViewAdapter); - if (!Utilities.isRTL) { + if (!LocaleController.isRTL) { listView.setPadding(Utilities.dp(16), listView.getPaddingTop(), Utilities.dp(30), listView.getPaddingBottom()); } else { listView.setPadding(Utilities.dp(30), listView.getPaddingTop(), Utilities.dp(16), listView.getPaddingBottom()); @@ -269,7 +270,7 @@ public class CountrySelectActivity extends ActionBarActivity { listView.setVerticalScrollBarEnabled(false); applySelfActionBar(); - epmtyTextView.setText(getString(R.string.ChooseCountry)); + emptyTextView.setText(getString(R.string.ChooseCountry)); return true; } }); @@ -305,24 +306,24 @@ public class CountrySelectActivity extends ActionBarActivity { } } - public void searchDialogs(final String query) { + public void search(final String query) { if (query == null) { searchResult = null; } else { try { - if (searchDialogsTimer != null) { - searchDialogsTimer.cancel(); + if (searchTimer != null) { + searchTimer.cancel(); } } catch (Exception e) { FileLog.e("tmessages", e); } - searchDialogsTimer = new Timer(); - searchDialogsTimer.schedule(new TimerTask() { + searchTimer = new Timer(); + searchTimer.schedule(new TimerTask() { @Override public void run() { try { - searchDialogsTimer.cancel(); - searchDialogsTimer = null; + searchTimer.cancel(); + searchTimer = null; } catch (Exception e) { FileLog.e("tmessages", e); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/GalleryImageViewer.java b/TMessagesProj/src/main/java/org/telegram/ui/GalleryImageViewer.java index b0206d4a8..6548dc710 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/GalleryImageViewer.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/GalleryImageViewer.java @@ -374,9 +374,9 @@ public class GalleryImageViewer extends AbstractGalleryActivity implements Notif Utilities.RunOnUIThread(new Runnable() { @Override public void run() { - getSupportActionBar().setTitle(String.format("%d %s %d", pos, LocaleController.getString("Of", R.string.Of), totalCount)); + getSupportActionBar().setTitle(LocaleController.formatString("Of", R.string.Of, pos, totalCount)); if (title != null) { - fakeTitleView.setText(String.format("%d %s %d", pos, LocaleController.getString("Of", R.string.Of), totalCount)); + fakeTitleView.setText(LocaleController.formatString("Of", R.string.Of, pos, totalCount)); fakeTitleView.measure(View.MeasureSpec.makeMeasureSpec(400, View.MeasureSpec.AT_MOST), View.MeasureSpec.makeMeasureSpec(100, View.MeasureSpec.AT_MOST)); title.setWidth(fakeTitleView.getMeasuredWidth() + Utilities.dp(8)); title.setMaxWidth(fakeTitleView.getMeasuredWidth() + Utilities.dp(8)); @@ -565,7 +565,7 @@ public class GalleryImageViewer extends AbstractGalleryActivity implements Notif TLRPC.User user = MessagesController.getInstance().users.get(obj.messageOwner.from_id); if (user != null) { nameTextView.setText(Utilities.formatName(user.first_name, user.last_name)); - timeTextView.setText(Utilities.formatterYearMax.format(((long)obj.messageOwner.date) * 1000)); + timeTextView.setText(LocaleController.formatterYearMax.format(((long)obj.messageOwner.date) * 1000)); } else { nameTextView.setText(""); } @@ -866,9 +866,9 @@ public class GalleryImageViewer extends AbstractGalleryActivity implements Notif Utilities.RunOnUIThread(new Runnable() { @Override public void run() { - getSupportActionBar().setTitle(String.format("%d %s %d", (totalCount - imagesArr.size()) + position + 1, LocaleController.getString("Of", R.string.Of), totalCount)); + getSupportActionBar().setTitle(LocaleController.formatString("Of", R.string.Of, (totalCount - imagesArr.size()) + position + 1, totalCount)); if (title != null) { - fakeTitleView.setText(String.format("%d %s %d", (totalCount - imagesArr.size()) + position + 1, LocaleController.getString("Of", R.string.Of), totalCount)); + fakeTitleView.setText(LocaleController.formatString("Of", R.string.Of, (totalCount - imagesArr.size()) + position + 1, totalCount)); fakeTitleView.measure(View.MeasureSpec.makeMeasureSpec(400, View.MeasureSpec.AT_MOST), View.MeasureSpec.makeMeasureSpec(100, View.MeasureSpec.AT_MOST)); title.setWidth(fakeTitleView.getMeasuredWidth() + Utilities.dp(8)); title.setMaxWidth(fakeTitleView.getMeasuredWidth() + Utilities.dp(8)); @@ -885,9 +885,9 @@ public class GalleryImageViewer extends AbstractGalleryActivity implements Notif Utilities.RunOnUIThread(new Runnable() { @Override public void run() { - getSupportActionBar().setTitle(String.format("%d %s %d", position + 1, LocaleController.getString("Of", R.string.Of), imagesArrLocations.size())); + getSupportActionBar().setTitle(LocaleController.formatString("Of", R.string.Of, position + 1, imagesArrLocations.size())); if (title != null) { - fakeTitleView.setText(String.format("%d %s %d", position + 1, LocaleController.getString("Of", R.string.Of), imagesArrLocations.size())); + fakeTitleView.setText(LocaleController.formatString("Of", R.string.Of, position + 1, imagesArrLocations.size())); fakeTitleView.measure(View.MeasureSpec.makeMeasureSpec(400, View.MeasureSpec.AT_MOST), View.MeasureSpec.makeMeasureSpec(100, View.MeasureSpec.AT_MOST)); title.setWidth(fakeTitleView.getMeasuredWidth() + Utilities.dp(8)); title.setMaxWidth(fakeTitleView.getMeasuredWidth() + Utilities.dp(8)); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/GroupCreateActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/GroupCreateActivity.java index 3015e4ca2..5776b0a04 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/GroupCreateActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/GroupCreateActivity.java @@ -18,7 +18,6 @@ import android.os.Bundle; import android.support.v4.internal.view.SupportMenuItem; import android.support.v7.app.ActionBar; import android.text.Editable; -import android.text.Html; import android.text.Spannable; import android.text.SpannableString; import android.text.SpannableStringBuilder; @@ -35,6 +34,7 @@ import android.widget.EditText; import android.widget.ImageView; import android.widget.TextView; +import org.telegram.PhoneFormat.PhoneFormat; import org.telegram.messenger.LocaleController; import org.telegram.messenger.TLRPC; import org.telegram.messenger.ConnectionsManager; @@ -59,10 +59,8 @@ import java.util.TimerTask; public class GroupCreateActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate { private SectionedBaseAdapter listViewAdapter; private PinnedHeaderListView listView; - private TextView epmtyTextView; - private TextView doneTextView; + private TextView emptyTextView; private EditText userSelectEditText; - private TextView countTextView; private boolean ignoreChange = false; private HashMap selectedContacts = new HashMap(); @@ -70,7 +68,7 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen private boolean searchWas; private boolean searching; - private Timer searchDialogsTimer; + private Timer searchTimer; public ArrayList searchResult; public ArrayList searchResultNames; @@ -113,11 +111,10 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen fragmentView = inflater.inflate(R.layout.group_create_layout, container, false); - epmtyTextView = (TextView)fragmentView.findViewById(R.id.searchEmptyView); - epmtyTextView.setText(LocaleController.getString("NoContacts", R.string.NoContacts)); + emptyTextView = (TextView)fragmentView.findViewById(R.id.searchEmptyView); + emptyTextView.setText(LocaleController.getString("NoContacts", R.string.NoContacts)); userSelectEditText = (EditText)fragmentView.findViewById(R.id.bubble_input_text); userSelectEditText.setHint(LocaleController.getString("SendMessageTo", R.string.SendMessageTo)); - countTextView = (TextView)fragmentView.findViewById(R.id.bubble_counter_text); if (Build.VERSION.SDK_INT >= 11) { userSelectEditText.setTextIsSelectable(false); } @@ -159,12 +156,10 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen selectedContacts.remove(sp.uid); } } - if (selectedContacts.isEmpty()) { - doneTextView.setText(LocaleController.getString("Done", R.string.Done)); - } else { - doneTextView.setText(LocaleController.getString("Done", R.string.Done) + " (" + selectedContacts.size() + ")"); + if (parentActivity != null) { + ActionBar actionBar = parentActivity.getSupportActionBar(); + actionBar.setSubtitle(String.format("%d/200 %s", selectedContacts.size(), LocaleController.getString("Members", R.string.Members))); } - countTextView.setText(selectedContacts.size() + "/200"); listView.invalidateViews(); } else { search = true; @@ -178,14 +173,14 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen searchDialogs(text); searching = true; searchWas = true; - epmtyTextView.setText(LocaleController.getString("NoResult", R.string.NoResult)); + emptyTextView.setText(LocaleController.getString("NoResult", R.string.NoResult)); listViewAdapter.notifyDataSetChanged(); } else { searchResult = null; searchResultNames = null; searching = false; searchWas = false; - epmtyTextView.setText(LocaleController.getString("NoContacts", R.string.NoContacts)); + emptyTextView.setText(LocaleController.getString("NoContacts", R.string.NoContacts)); listViewAdapter.notifyDataSetChanged(); } } @@ -194,7 +189,7 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen }); listView = (PinnedHeaderListView)fragmentView.findViewById(R.id.listView); - listView.setEmptyView(epmtyTextView); + listView.setEmptyView(emptyTextView); listView.setVerticalScrollBarEnabled(false); listView.setAdapter(listViewAdapter = new ListAdapter(parentActivity)); @@ -230,16 +225,14 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen span.uid = user.id; ignoreChange = false; } - if (selectedContacts.isEmpty()) { - doneTextView.setText(LocaleController.getString("Done", R.string.Done)); - } else { - doneTextView.setText(LocaleController.getString("Done", R.string.Done) + " (" + selectedContacts.size() + ")"); + if (parentActivity != null) { + ActionBar actionBar = parentActivity.getSupportActionBar(); + actionBar.setSubtitle(String.format("%d/200 %s", selectedContacts.size(), LocaleController.getString("Members", R.string.Members))); } - countTextView.setText(selectedContacts.size() + "/200"); if (searching || searchWas) { searching = false; searchWas = false; - epmtyTextView.setText(LocaleController.getString("NoContacts", R.string.NoContacts)); + emptyTextView.setText(LocaleController.getString("NoContacts", R.string.NoContacts)); ignoreChange = true; SpannableStringBuilder ssb = new SpannableStringBuilder(""); @@ -279,6 +272,7 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen actionBar.setDisplayShowCustomEnabled(false); actionBar.setCustomView(null); actionBar.setTitle(LocaleController.getString("NewGroup", R.string.NewGroup)); + actionBar.setSubtitle(String.format("%d/200 %s", selectedContacts.size(), LocaleController.getString("Members", R.string.Members))); TextView title = (TextView)parentActivity.findViewById(R.id.action_bar_title); if (title == null) { @@ -305,7 +299,11 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen LayoutInflater lf = (LayoutInflater)parentActivity.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); View textView = lf.inflate(R.layout.group_create_bubble, null); TextView text = (TextView)textView.findViewById(R.id.bubble_text_view); - text.setText(Utilities.formatName(user.first_name, user.last_name)); + String name = Utilities.formatName(user.first_name, user.last_name); + if (name.length() == 0 && user.phone != null && user.phone.length() != 0) { + name = PhoneFormat.getInstance().format("+" + user.phone); + } + text.setText(name + ", "); int spec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED); textView.measure(spec, spec); @@ -341,19 +339,19 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen searchResultNames = null; } else { try { - if (searchDialogsTimer != null) { - searchDialogsTimer.cancel(); + if (searchTimer != null) { + searchTimer.cancel(); } } catch (Exception e) { FileLog.e("tmessages", e); } - searchDialogsTimer = new Timer(); - searchDialogsTimer.schedule(new TimerTask() { + searchTimer = new Timer(); + searchTimer.schedule(new TimerTask() { @Override public void run() { try { - searchDialogsTimer.cancel(); - searchDialogsTimer = null; + searchTimer.cancel(); + searchTimer = null; } catch (Exception e) { FileLog.e("tmessages", e); } @@ -425,8 +423,8 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.group_create_menu, menu); SupportMenuItem doneItem = (SupportMenuItem)menu.findItem(R.id.done_menu_item); - doneTextView = (TextView)doneItem.getActionView().findViewById(R.id.done_button); - doneTextView.setText(LocaleController.getString("Done", R.string.Done)); + TextView doneTextView = (TextView)doneItem.getActionView().findViewById(R.id.done_button); + doneTextView.setText(LocaleController.getString("Next", R.string.Next)); doneTextView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { @@ -525,9 +523,9 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen ImageView checkButton = (ImageView)convertView.findViewById(R.id.settings_row_check_button); if (selectedContacts.containsKey(user.id)) { - checkButton.setImageResource(R.drawable.btn_check_on_old); + checkButton.setImageResource(R.drawable.btn_check_on_holo_light); } else { - checkButton.setImageResource(R.drawable.btn_check_off_old); + checkButton.setImageResource(R.drawable.btn_check_off_holo_light); } View divider = convertView.findViewById(R.id.settings_row_divider); @@ -540,13 +538,15 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen if (searchWas && searching) { holder.nameTextView.setText(searchResultNames.get(position)); } else { - if (user.first_name.length() != 0 && user.last_name.length() != 0) { - holder.nameTextView.setText(Html.fromHtml(user.first_name + " " + user.last_name + "")); - } else if (user.first_name.length() != 0) { - holder.nameTextView.setText(Html.fromHtml("" + user.first_name + "")); - } else { - holder.nameTextView.setText(Html.fromHtml("" + user.last_name + "")); + String name = Utilities.formatName(user.first_name, user.last_name); + if (name.length() == 0) { + if (user.phone != null && user.phone.length() != 0) { + name = PhoneFormat.getInstance().format("+" + user.phone); + } else { + name = LocaleController.getString("HiddenName", R.string.HiddenName); + } } + holder.nameTextView.setText(name); } TLRPC.FileLocation photo = null; @@ -568,7 +568,7 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen if (user.status.expires <= 10000) { holder.messageTextView.setText(LocaleController.getString("Invisible", R.string.Invisible)); } else { - holder.messageTextView.setText(Utilities.formatDateOnline(user.status.expires)); + holder.messageTextView.setText(LocaleController.formatDateOnline(user.status.expires)); } holder.messageTextView.setTextColor(0xff808080); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/GroupCreateFinalActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/GroupCreateFinalActivity.java index e01022b66..79438d064 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/GroupCreateFinalActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/GroupCreateFinalActivity.java @@ -148,6 +148,7 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati actionBar.setDisplayUseLogoEnabled(false); actionBar.setDisplayShowCustomEnabled(false); actionBar.setCustomView(null); + actionBar.setSubtitle(null); actionBar.setTitle(LocaleController.getString("NewGroup", R.string.NewGroup)); TextView title = (TextView)parentActivity.findViewById(R.id.action_bar_title); @@ -346,7 +347,6 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati if (convertView == null) { convertView = new ChatOrUserCell(mContext); - ((ChatOrUserCell)convertView).useBoldFont = true; ((ChatOrUserCell)convertView).usePadding = false; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/IntroActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/IntroActivity.java index 158c1bb8d..292d696a8 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/IntroActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/IntroActivity.java @@ -44,7 +44,7 @@ public class IntroActivity extends ActionBarActivity { setContentView(R.layout.intro_layout); - if (Utilities.isRTL) { + if (LocaleController.isRTL) { icons = new int[] { R.drawable.intro7, R.drawable.intro6, @@ -209,7 +209,7 @@ public class IntroActivity extends ActionBarActivity { protected void onResume() { super.onResume(); if (justCreated) { - if (Utilities.isRTL) { + if (LocaleController.isRTL) { viewPager.setCurrentItem(6); lastPage = 6; } else { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/LanguageSelectActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/LanguageSelectActivity.java new file mode 100644 index 000000000..53cdb2125 --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/ui/LanguageSelectActivity.java @@ -0,0 +1,492 @@ +/* + * This is the source code of Telegram for Android v. 1.3.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 android.content.Context; +import android.os.Bundle; +import android.support.v4.internal.view.SupportMenuItem; +import android.support.v4.view.MenuItemCompat; +import android.support.v7.app.ActionBar; +import android.support.v7.widget.SearchView; +import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; +import android.view.View; +import android.view.ViewGroup; +import android.widget.AdapterView; +import android.widget.BaseAdapter; +import android.widget.ImageView; +import android.widget.ListView; +import android.widget.TextView; + +import org.telegram.messenger.FileLog; +import org.telegram.messenger.LocaleController; +import org.telegram.messenger.R; +import org.telegram.messenger.Utilities; +import org.telegram.ui.Views.BaseFragment; +import org.telegram.ui.Views.OnSwipeTouchListener; + +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.Timer; +import java.util.TimerTask; + +public class LanguageSelectActivity extends BaseFragment { + private SupportMenuItem searchItem; + private SearchView searchView; + private BaseAdapter listAdapter; + private ListView listView; + private boolean searchWas; + private boolean searching; + private BaseAdapter searchListViewAdapter; + private TextView emptyTextView; + + private Timer searchTimer; + public ArrayList searchResult; + + @Override + public boolean onFragmentCreate() { + super.onFragmentCreate(); + return true; + } + + @Override + public void onFragmentDestroy() { + super.onFragmentDestroy(); + } + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setHasOptionsMenu(true); + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + if (fragmentView == null) { + fragmentView = inflater.inflate(R.layout.language_select_layout, container, false); + listAdapter = new ListAdapter(parentActivity); + listView = (ListView)fragmentView.findViewById(R.id.listView); + listView.setAdapter(listAdapter); + emptyTextView = (TextView)fragmentView.findViewById(R.id.searchEmptyView); + listView.setEmptyView(emptyTextView); + searchListViewAdapter = new SearchAdapter(parentActivity); + + listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView adapterView, View view, int i, long l) { + if (parentActivity == null) { + return; + } + LocaleController.LocaleInfo localeInfo = null; + if (searching && searchWas) { + if (i >= 0 && i < searchResult.size()) { + localeInfo = searchResult.get(i); + } + } else { + if (i >= 0 && i < LocaleController.getInstance().sortedLanguages.size()) { + localeInfo = LocaleController.getInstance().sortedLanguages.get(i); + } + } + if (localeInfo != null) { + boolean isRTL = LocaleController.isRTL; + LocaleController.getInstance().applyLanguage(localeInfo, true); + if (isRTL != LocaleController.isRTL) { + for (BaseFragment fragment : ApplicationLoader.fragmentsStack) { + if (fragment == LanguageSelectActivity.this) { + continue; + } + if (fragment.fragmentView != null) { + ViewGroup parent = (ViewGroup)fragment.fragmentView.getParent(); + if (parent != null) { + parent.removeView(fragment.fragmentView); + } + fragment.fragmentView = null; + } + fragment.parentActivity = parentActivity; + } + } + } + finishFragment(); + } + }); + + listView.setOnTouchListener(new OnSwipeTouchListener() { + public void onSwipeRight() { + finishFragment(true); + } + }); + + searching = false; + searchWas = false; + } else { + ViewGroup parent = (ViewGroup)fragmentView.getParent(); + if (parent != null) { + parent.removeView(fragmentView); + } + } + return fragmentView; + } + + @Override + public void applySelfActionBar() { + if (parentActivity == null) { + return; + } + ActionBar actionBar = parentActivity.getSupportActionBar(); + actionBar.setDisplayShowTitleEnabled(true); + actionBar.setDisplayShowHomeEnabled(false); + actionBar.setDisplayHomeAsUpEnabled(true); + actionBar.setDisplayUseLogoEnabled(false); + actionBar.setDisplayShowCustomEnabled(false); + actionBar.setCustomView(null); + actionBar.setSubtitle(null); + + TextView title = (TextView)parentActivity.findViewById(R.id.action_bar_title); + if (title == null) { + final int subtitleId = parentActivity.getResources().getIdentifier("action_bar_title", "id", "android"); + title = (TextView)parentActivity.findViewById(subtitleId); + } + if (title != null) { + title.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0); + title.setCompoundDrawablePadding(0); + } + actionBar.setTitle(LocaleController.getString("Language", R.string.Language)); + ((LaunchActivity)parentActivity).fixBackButton(); + } + + @Override + public void onResume() { + super.onResume(); + if (isFinish) { + return; + } + if (getActivity() == null) { + return; + } + if (!firstStart && listAdapter != null) { + listAdapter.notifyDataSetChanged(); + } + firstStart = false; + ((LaunchActivity)parentActivity).showActionBar(); + ((LaunchActivity)parentActivity).updateActionBar(); + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + int itemId = item.getItemId(); + switch (itemId) { + case android.R.id.home: + if (searchItem != null) { + if (searchItem.isActionViewExpanded()) { + searchItem.collapseActionView(); + } + } + finishFragment(); + break; + } + return true; + } + + @Override + public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { + inflater.inflate(R.menu.contacts_menu, menu); + searchItem = (SupportMenuItem)menu.findItem(R.id.messages_list_menu_search); + searchView = (SearchView)searchItem.getActionView(); + + TextView textView = (TextView) searchView.findViewById(R.id.search_src_text); + if (textView != null) { + textView.setTextColor(0xffffffff); + try { + Field mCursorDrawableRes = TextView.class.getDeclaredField("mCursorDrawableRes"); + mCursorDrawableRes.setAccessible(true); + mCursorDrawableRes.set(textView, R.drawable.search_carret); + } catch (Exception e) { + e.printStackTrace(); + } + } + + ImageView img = (ImageView) searchView.findViewById(R.id.search_close_btn); + if (img != null) { + img.setImageResource(R.drawable.ic_msg_btn_cross_custom); + } + + searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { + @Override + public boolean onQueryTextSubmit(String s) { + return true; + } + + @Override + public boolean onQueryTextChange(String s) { + search(s); + if (s.length() != 0) { + searchWas = true; + if (listView != null) { + listView.setPadding(Utilities.dp(16), listView.getPaddingTop(), Utilities.dp(16), listView.getPaddingBottom()); + listView.setAdapter(searchListViewAdapter); + if(android.os.Build.VERSION.SDK_INT >= 11) { + listView.setFastScrollAlwaysVisible(false); + } + listView.setFastScrollEnabled(false); + listView.setVerticalScrollBarEnabled(true); + } + if (emptyTextView != null) { + emptyTextView.setText(getString(R.string.NoResult)); + } + } + return true; + } + }); + + searchItem.setSupportOnActionExpandListener(new MenuItemCompat.OnActionExpandListener() { + @Override + public boolean onMenuItemActionExpand(MenuItem menuItem) { + if (parentActivity != null) { + parentActivity.getSupportActionBar().setIcon(R.drawable.ic_ab_search); + } + searching = true; + return true; + } + + @Override + public boolean onMenuItemActionCollapse(MenuItem menuItem) { + searchView.setQuery("", false); + search(null); + searching = false; + searchWas = false; + if (listView != null) { + listView.setEmptyView(emptyTextView); + emptyTextView.setVisibility(View.GONE); + } + if (listAdapter != null) { + listAdapter.notifyDataSetChanged(); + } + ((LaunchActivity)parentActivity).fixBackButton(); + return true; + } + }); + + super.onCreateOptionsMenu(menu, inflater); + } + + public void search(final String query) { + if (query == null) { + searchResult = null; + } else { + try { + if (searchTimer != null) { + searchTimer.cancel(); + } + } catch (Exception e) { + FileLog.e("tmessages", e); + } + searchTimer = new Timer(); + searchTimer.schedule(new TimerTask() { + @Override + public void run() { + try { + searchTimer.cancel(); + searchTimer = null; + } catch (Exception e) { + FileLog.e("tmessages", e); + } + processSearch(query); + } + }, 100, 300); + } + } + + private void processSearch(final String query) { + Utilities.globalQueue.postRunnable(new Runnable() { + @Override + public void run() { + + String q = query.trim().toLowerCase(); + if (q.length() == 0) { + updateSearchResults(new ArrayList()); + return; + } + long time = System.currentTimeMillis(); + ArrayList resultArray = new ArrayList(); + + for (LocaleController.LocaleInfo c : LocaleController.getInstance().sortedLanguages) { + if (c.name.toLowerCase().startsWith(query) || c.nameEnglish.toLowerCase().startsWith(query)) { + resultArray.add(c); + } + } + + updateSearchResults(resultArray); + } + }); + } + + private void updateSearchResults(final ArrayList arrCounties) { + Utilities.RunOnUIThread(new Runnable() { + @Override + public void run() { + searchResult = arrCounties; + searchListViewAdapter.notifyDataSetChanged(); + } + }); + } + + private class SearchAdapter extends BaseAdapter { + private Context mContext; + + public SearchAdapter(Context context) { + mContext = context; + } + + @Override + public boolean areAllItemsEnabled() { + return true; + } + + @Override + public boolean isEnabled(int i) { + return true; + } + + @Override + public int getCount() { + if (searchResult == null) { + return 0; + } + return searchResult.size(); + } + + @Override + public Object getItem(int i) { + return null; + } + + @Override + public long getItemId(int i) { + return i; + } + + @Override + public boolean hasStableIds() { + return false; + } + + @Override + public View getView(int i, View view, ViewGroup viewGroup) { + if (view == null) { + LayoutInflater li = (LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + view = li.inflate(R.layout.settings_row_button_layout, viewGroup, false); + } + TextView textView = (TextView)view.findViewById(R.id.settings_row_text); + View divider = view.findViewById(R.id.settings_row_divider); + + LocaleController.LocaleInfo c = searchResult.get(i); + textView.setText(c.name); + if (i == searchResult.size() - 1) { + divider.setVisibility(View.GONE); + } else { + divider.setVisibility(View.VISIBLE); + } + + return view; + } + + @Override + public int getItemViewType(int i) { + return 0; + } + + @Override + public int getViewTypeCount() { + return 1; + } + + @Override + public boolean isEmpty() { + return searchResult == null || searchResult.size() == 0; + } + } + + private class ListAdapter extends BaseAdapter { + private Context mContext; + + public ListAdapter(Context context) { + mContext = context; + } + + @Override + public boolean areAllItemsEnabled() { + return true; + } + + @Override + public boolean isEnabled(int i) { + return true; + } + + @Override + public int getCount() { + if (LocaleController.getInstance().sortedLanguages == null) { + return 0; + } + return LocaleController.getInstance().sortedLanguages.size(); + } + + @Override + public Object getItem(int i) { + return null; + } + + @Override + public long getItemId(int i) { + return i; + } + + @Override + public boolean hasStableIds() { + return false; + } + + @Override + public View getView(int i, View view, ViewGroup viewGroup) { + if (view == null) { + LayoutInflater li = (LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + view = li.inflate(R.layout.settings_row_button_layout, viewGroup, false); + } + TextView textView = (TextView)view.findViewById(R.id.settings_row_text); + View divider = view.findViewById(R.id.settings_row_divider); + + LocaleController.LocaleInfo localeInfo = LocaleController.getInstance().sortedLanguages.get(i); + textView.setText(localeInfo.name); + if (i == LocaleController.getInstance().sortedLanguages.size() - 1) { + divider.setVisibility(View.GONE); + } else { + divider.setVisibility(View.VISIBLE); + } + + return view; + } + + @Override + public int getItemViewType(int i) { + return 0; + } + + @Override + public int getViewTypeCount() { + return 1; + } + + @Override + public boolean isEmpty() { + return LocaleController.getInstance().sortedLanguages == null || LocaleController.getInstance().sortedLanguages.size() == 0; + } + } +} diff --git a/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java index b7dc4a5d0..0b003f29d 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java @@ -86,7 +86,7 @@ public class LaunchActivity extends ActionBarActivity implements NotificationCen if (!UserConfig.clientActivated) { Intent intent = getIntent(); - if (intent != null && intent.getAction() != null && Intent.ACTION_SEND.equals(intent.getAction()) || intent.getAction().equals(Intent.ACTION_SEND_MULTIPLE)) { + if (intent != null && intent.getAction() != null && (Intent.ACTION_SEND.equals(intent.getAction()) || intent.getAction().equals(Intent.ACTION_SEND_MULTIPLE))) { finish(); return; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/MessagesActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/MessagesActivity.java index d0faa55b3..d7079ca04 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/MessagesActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/MessagesActivity.java @@ -69,7 +69,7 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter private int activityToken = (int)(MessagesController.random.nextDouble() * Integer.MAX_VALUE); private long selectedDialog; - private Timer searchDialogsTimer; + private Timer searchTimer; public ArrayList searchResult; public ArrayList searchResultNames; @@ -511,19 +511,19 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter searchResultNames = null; } else { try { - if (searchDialogsTimer != null) { - searchDialogsTimer.cancel(); + if (searchTimer != null) { + searchTimer.cancel(); } } catch (Exception e) { FileLog.e("tmessages", e); } - searchDialogsTimer = new Timer(); - searchDialogsTimer.schedule(new TimerTask() { + searchTimer = new Timer(); + searchTimer.schedule(new TimerTask() { @Override public void run() { try { - searchDialogsTimer.cancel(); - searchDialogsTimer = null; + searchTimer.cancel(); + searchTimer = null; } catch (Exception e) { FileLog.e("tmessages", e); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/SettingsActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/SettingsActivity.java index 290462bed..210623414 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/SettingsActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/SettingsActivity.java @@ -87,6 +87,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter private int audioDownloadSection; private int audioDownloadChatRow; private int audioDownloadPrivateRow; + private int languageRow; @Override public boolean onFragmentCreate() { @@ -156,6 +157,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter numberRow = rowCount++; settingsSectionRow = rowCount++; enableAnimationsRow = rowCount++; + languageRow = rowCount++; notificationRow = rowCount++; blockedRow = rowCount++; backgroundRow = rowCount++; @@ -206,7 +208,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter if (i == textSizeRow) { AlertDialog.Builder builder = new AlertDialog.Builder(parentActivity); builder.setTitle(LocaleController.getString("TextSize", R.string.TextSize)); - builder.setItems(new CharSequence[]{String.format("%d", 12), String.format("%d", 13), String.format("%d", 14), String.format("%d", 15), String.format("%d", 16), String.format("%d", 17), String.format("%d", 18), String.format("%d", 19), String.format("%d", 20)}, new DialogInterface.OnClickListener() { + builder.setItems(new CharSequence[]{String.format("%d", 12), String.format("%d", 13), String.format("%d", 14), String.format("%d", 15), String.format("%d", 16), String.format("%d", 17), String.format("%d", 18), String.format("%d", 19), String.format("%d", 20), String.format("%d", 21), String.format("%d", 22), String.format("%d", 23), String.format("%d", 24)}, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE); @@ -404,6 +406,8 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter if (listView != null) { listView.invalidateViews(); } + } else if (i == languageRow) { + ((LaunchActivity)parentActivity).presentFragment(new LanguageSelectActivity(), "settings_wallpapers", false); } // else if (i == 6) { // UserConfig.saveIncomingPhotos = !UserConfig.saveIncomingPhotos; @@ -538,7 +542,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter public boolean isEnabled(int i) { return i == textSizeRow || i == enableAnimationsRow || i == blockedRow || i == notificationRow || i == backgroundRow || i == askQuestionRow || i == sendLogsRow || i == sendByEnterRow || i == terminateSessionsRow || i == photoDownloadPrivateRow || - i == photoDownloadChatRow || i == clearLogsRow || i == audioDownloadChatRow || i == audioDownloadPrivateRow; + i == photoDownloadChatRow || i == clearLogsRow || i == audioDownloadChatRow || i == audioDownloadPrivateRow || i == languageRow; } @Override @@ -569,9 +573,6 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter LayoutInflater li = (LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); view = li.inflate(R.layout.settings_name_layout, viewGroup, false); - TextView textView = (TextView)view.findViewById(R.id.settings_online); - textView.setText(LocaleController.getString("Online", R.string.Online)); - ImageButton button = (ImageButton)view.findViewById(R.id.settings_edit_name); button.setOnClickListener(new View.OnClickListener() { @Override @@ -672,7 +673,10 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter } }); } - TextView textView = (TextView)view.findViewById(R.id.settings_name); + TextView textView = (TextView)view.findViewById(R.id.settings_online); + textView.setText(LocaleController.getString("Online", R.string.Online)); + + textView = (TextView)view.findViewById(R.id.settings_name); Typeface typeface = Utilities.getTypeface("fonts/rmedium.ttf"); textView.setTypeface(typeface); TLRPC.User user = MessagesController.getInstance().users.get(UserConfig.clientUserId); @@ -860,9 +864,12 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter detailTextView.setText(String.format("%d", size)); textView.setText(LocaleController.getString("TextSize", R.string.TextSize)); divider.setVisibility(View.VISIBLE); + } else if (i == languageRow) { + detailTextView.setText(LocaleController.getCurrentLanguageName()); + textView.setText(LocaleController.getString("Language", R.string.Language)); + divider.setVisibility(View.VISIBLE); } } - return view; } @@ -872,7 +879,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter return 0; } else if (i == numberSectionRow || i == settingsSectionRow || i == supportSectionRow || i == messagesSectionRow || i == photoDownloadSection || i == audioDownloadSection) { return 1; - } else if (i == textSizeRow) { + } else if (i == textSizeRow || i == languageRow) { return 5; } else if (i == enableAnimationsRow || i == sendByEnterRow || i == photoDownloadChatRow || i == photoDownloadPrivateRow || i == audioDownloadChatRow || i == audioDownloadPrivateRow) { return 3; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/SettingsBlockedUsers.java b/TMessagesProj/src/main/java/org/telegram/ui/SettingsBlockedUsers.java index eb284c45c..237ef0280 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/SettingsBlockedUsers.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/SettingsBlockedUsers.java @@ -386,7 +386,6 @@ public class SettingsBlockedUsers extends BaseFragment implements NotificationCe if (type == 0) { if (view == null) { view = new ChatOrUserCell(mContext); - ((ChatOrUserCell)view).useBoldFont = true; ((ChatOrUserCell)view).usePadding = false; ((ChatOrUserCell)view).useSeparator = true; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/UserProfileActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/UserProfileActivity.java index 4636d9c06..41993d46a 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/UserProfileActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/UserProfileActivity.java @@ -647,7 +647,7 @@ public class UserProfileActivity extends BaseFragment implements NotificationCen if (user.status.expires <= 10000) { onlineText.setText(LocaleController.getString("Invisible", R.string.Invisible)); } else { - onlineText.setText(Utilities.formatDateOnline(user.status.expires)); + onlineText.setText(LocaleController.formatDateOnline(user.status.expires)); } } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Views/NotificationView.java b/TMessagesProj/src/main/java/org/telegram/ui/Views/NotificationView.java index 476052fe1..7265fce50 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Views/NotificationView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Views/NotificationView.java @@ -23,6 +23,7 @@ import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; +import org.telegram.messenger.LocaleController; import org.telegram.messenger.TLRPC; import org.telegram.messenger.FileLog; import org.telegram.messenger.MessagesController; @@ -305,7 +306,7 @@ public class NotificationView extends LinearLayout { messageTextView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14); nameTextView.setPadding(0, Utilities.dp(2), 0, 0); messageTextView.setPadding(0, Utilities.dp(18), 0, 0); - if (Utilities.isRTL) { + if (LocaleController.isRTL) { params1.setMargins(Utilities.dp(40), 0, height + Utilities.dp(6), 0); } else { params1.setMargins(height + Utilities.dp(6), 0, Utilities.dp(40), 0); @@ -315,7 +316,7 @@ public class NotificationView extends LinearLayout { messageTextView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 15); nameTextView.setPadding(0, Utilities.dp(4), 0, 0); messageTextView.setPadding(0, Utilities.dp(24), 0, 0); - if (Utilities.isRTL) { + if (LocaleController.isRTL) { params1.setMargins(Utilities.dp(40), 0, height + Utilities.dp(8), 0); } else { params1.setMargins(height + Utilities.dp(8), 0, Utilities.dp(40), 0); diff --git a/TMessagesProj/src/main/res/color/chat_create_bubble_text_states.xml b/TMessagesProj/src/main/res/color/chat_create_bubble_text_states.xml deleted file mode 100644 index 36e36ca51..000000000 --- a/TMessagesProj/src/main/res/color/chat_create_bubble_text_states.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/TMessagesProj/src/main/res/drawable-hdpi/btn_check_off_pressed_holo_light.png b/TMessagesProj/src/main/res/drawable-hdpi/btn_check_off_pressed_holo_light.png deleted file mode 100644 index 0f54a35b1..000000000 Binary files a/TMessagesProj/src/main/res/drawable-hdpi/btn_check_off_pressed_holo_light.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable-hdpi/btn_check_on_pressed_holo_light.png b/TMessagesProj/src/main/res/drawable-hdpi/btn_check_on_pressed_holo_light.png deleted file mode 100644 index d4ce43712..000000000 Binary files a/TMessagesProj/src/main/res/drawable-hdpi/btn_check_on_pressed_holo_light.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable-hdpi/compose_bubble_down.9.png b/TMessagesProj/src/main/res/drawable-hdpi/compose_bubble_down.9.png deleted file mode 100644 index b298d4ccd..000000000 Binary files a/TMessagesProj/src/main/res/drawable-hdpi/compose_bubble_down.9.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable-hdpi/compose_bubble_up.9.png b/TMessagesProj/src/main/res/drawable-hdpi/compose_bubble_up.9.png deleted file mode 100644 index 5f65aa7e0..000000000 Binary files a/TMessagesProj/src/main/res/drawable-hdpi/compose_bubble_up.9.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable-mdpi/btn_check_off_pressed_holo_light.png b/TMessagesProj/src/main/res/drawable-mdpi/btn_check_off_pressed_holo_light.png deleted file mode 100644 index 4c358b6c7..000000000 Binary files a/TMessagesProj/src/main/res/drawable-mdpi/btn_check_off_pressed_holo_light.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable-mdpi/btn_check_on_pressed_holo_light.png b/TMessagesProj/src/main/res/drawable-mdpi/btn_check_on_pressed_holo_light.png deleted file mode 100644 index e9742a1f9..000000000 Binary files a/TMessagesProj/src/main/res/drawable-mdpi/btn_check_on_pressed_holo_light.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable-mdpi/compose_bubble_down.9.png b/TMessagesProj/src/main/res/drawable-mdpi/compose_bubble_down.9.png deleted file mode 100644 index 254a654fd..000000000 Binary files a/TMessagesProj/src/main/res/drawable-mdpi/compose_bubble_down.9.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable-mdpi/compose_bubble_up.9.png b/TMessagesProj/src/main/res/drawable-mdpi/compose_bubble_up.9.png deleted file mode 100644 index dd401ff34..000000000 Binary files a/TMessagesProj/src/main/res/drawable-mdpi/compose_bubble_up.9.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/btn_check_off_pressed_holo_light.png b/TMessagesProj/src/main/res/drawable-xhdpi/btn_check_off_pressed_holo_light.png deleted file mode 100644 index 2e8dff7e2..000000000 Binary files a/TMessagesProj/src/main/res/drawable-xhdpi/btn_check_off_pressed_holo_light.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/btn_check_on_pressed_holo_light.png b/TMessagesProj/src/main/res/drawable-xhdpi/btn_check_on_pressed_holo_light.png deleted file mode 100644 index c1d273a73..000000000 Binary files a/TMessagesProj/src/main/res/drawable-xhdpi/btn_check_on_pressed_holo_light.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/compose_bubble_down.9.png b/TMessagesProj/src/main/res/drawable-xhdpi/compose_bubble_down.9.png deleted file mode 100644 index b1003163a..000000000 Binary files a/TMessagesProj/src/main/res/drawable-xhdpi/compose_bubble_down.9.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/compose_bubble_up.9.png b/TMessagesProj/src/main/res/drawable-xhdpi/compose_bubble_up.9.png deleted file mode 100644 index ff521bb2d..000000000 Binary files a/TMessagesProj/src/main/res/drawable-xhdpi/compose_bubble_up.9.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/btn_check_off_pressed_holo_light.png b/TMessagesProj/src/main/res/drawable-xxhdpi/btn_check_off_pressed_holo_light.png deleted file mode 100644 index 98e8965fc..000000000 Binary files a/TMessagesProj/src/main/res/drawable-xxhdpi/btn_check_off_pressed_holo_light.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/btn_check_on_pressed_holo_light.png b/TMessagesProj/src/main/res/drawable-xxhdpi/btn_check_on_pressed_holo_light.png deleted file mode 100644 index fef30cc1d..000000000 Binary files a/TMessagesProj/src/main/res/drawable-xxhdpi/btn_check_on_pressed_holo_light.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/compose_bubble_down.9.png b/TMessagesProj/src/main/res/drawable-xxhdpi/compose_bubble_down.9.png deleted file mode 100644 index ab413e179..000000000 Binary files a/TMessagesProj/src/main/res/drawable-xxhdpi/compose_bubble_down.9.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/compose_bubble_up.9.png b/TMessagesProj/src/main/res/drawable-xxhdpi/compose_bubble_up.9.png deleted file mode 100644 index 4202efa5e..000000000 Binary files a/TMessagesProj/src/main/res/drawable-xxhdpi/compose_bubble_up.9.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable/btn_check_off_old.xml b/TMessagesProj/src/main/res/drawable/btn_check_off_old.xml deleted file mode 100644 index fff9507ba..000000000 --- a/TMessagesProj/src/main/res/drawable/btn_check_off_old.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/TMessagesProj/src/main/res/drawable/btn_check_on_old.xml b/TMessagesProj/src/main/res/drawable/btn_check_on_old.xml deleted file mode 100644 index 3923693ad..000000000 --- a/TMessagesProj/src/main/res/drawable/btn_check_on_old.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/TMessagesProj/src/main/res/drawable/chat_create_bubble_states.xml b/TMessagesProj/src/main/res/drawable/chat_create_bubble_states.xml deleted file mode 100644 index bba9664be..000000000 --- a/TMessagesProj/src/main/res/drawable/chat_create_bubble_states.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/TMessagesProj/src/main/res/layout-ar/group_create_final_layout.xml b/TMessagesProj/src/main/res/layout-ar/group_create_final_layout.xml index 8567d67a9..bfc162130 100644 --- a/TMessagesProj/src/main/res/layout-ar/group_create_final_layout.xml +++ b/TMessagesProj/src/main/res/layout-ar/group_create_final_layout.xml @@ -1,30 +1,35 @@ - + - + - + + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:src="@drawable/group_blue"/> + + - - + + 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"/> + diff --git a/TMessagesProj/src/main/res/layout-ar/group_create_layout.xml b/TMessagesProj/src/main/res/layout-ar/group_create_layout.xml index f674d7df0..1de70d4f7 100644 --- a/TMessagesProj/src/main/res/layout-ar/group_create_layout.xml +++ b/TMessagesProj/src/main/res/layout-ar/group_create_layout.xml @@ -21,7 +21,7 @@ android:layout_marginRight="5dp" android:minHeight="52dp" android:gravity="right|center_vertical" - android:maxLines="3" + android:maxLines="2" android:paddingTop="3dp" android:layout_marginTop="0dp" android:inputType="textFilter|textNoSuggestions|textMultiLine" @@ -29,18 +29,6 @@ android:textCursorDrawable="@null" android:textColor="#000000"/> - - diff --git a/TMessagesProj/src/main/res/layout-ar/group_create_row_layout.xml b/TMessagesProj/src/main/res/layout-ar/group_create_row_layout.xml index 2662414f0..d2eaad58c 100644 --- a/TMessagesProj/src/main/res/layout-ar/group_create_row_layout.xml +++ b/TMessagesProj/src/main/res/layout-ar/group_create_row_layout.xml @@ -1,57 +1,61 @@ - + + android:layout_width="50dp" + android:layout_height="50dp" + android:id="@+id/messages_list_row_avatar" + android:contentDescription="" + android:layout_marginTop="8dp" + android:layout_gravity="top|right"/> + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:id="@+id/messages_list_row_name" + android:textSize="18dp" + android:layout_marginRight="61dp" + android:ellipsize="end" + android:layout_marginTop="10dp" + android:textColor="#000000" + android:maxLines="1" + android:layout_marginLeft="60dp" + android:layout_gravity="top|right" + android:gravity="right"/> + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:id="@+id/messages_list_row_message" + android:textSize="15dp" + android:maxLines="1" + android:ellipsize="end" + android:textColor="#808080" + android:layout_marginLeft="60dp" + android:layout_marginTop="34dp" + android:layout_marginRight="61dp" + android:layout_gravity="top|right" + android:gravity="right"/> - + + + - \ No newline at end of file diff --git a/TMessagesProj/src/main/res/layout/chat_profile_change_name_layout.xml b/TMessagesProj/src/main/res/layout/chat_profile_change_name_layout.xml index 8e19219ee..81e5e34ea 100644 --- a/TMessagesProj/src/main/res/layout/chat_profile_change_name_layout.xml +++ b/TMessagesProj/src/main/res/layout/chat_profile_change_name_layout.xml @@ -5,14 +5,16 @@ android:layout_width="match_parent" android:layout_height="match_parent"> - - + - - + + diff --git a/TMessagesProj/src/main/res/layout/group_create_done_layout.xml b/TMessagesProj/src/main/res/layout/group_create_done_layout.xml index 0edcbfa9a..8c61137ce 100644 --- a/TMessagesProj/src/main/res/layout/group_create_done_layout.xml +++ b/TMessagesProj/src/main/res/layout/group_create_done_layout.xml @@ -1,7 +1,7 @@ @@ -19,6 +19,7 @@ android:paddingRight="16dp" android:paddingLeft="16dp" android:background="@drawable/bar_selector" - android:minHeight="60dp"/> + android:minHeight="60dp" + android:textAllCaps="true"/> \ No newline at end of file diff --git a/TMessagesProj/src/main/res/layout/group_create_final_layout.xml b/TMessagesProj/src/main/res/layout/group_create_final_layout.xml index 58cabae65..2970282e3 100644 --- a/TMessagesProj/src/main/res/layout/group_create_final_layout.xml +++ b/TMessagesProj/src/main/res/layout/group_create_final_layout.xml @@ -1,30 +1,35 @@ - + - + - + + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:src="@drawable/group_blue"/> + + - - + + 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"/> + diff --git a/TMessagesProj/src/main/res/layout/group_create_layout.xml b/TMessagesProj/src/main/res/layout/group_create_layout.xml index 3a3205816..763c3ea26 100644 --- a/TMessagesProj/src/main/res/layout/group_create_layout.xml +++ b/TMessagesProj/src/main/res/layout/group_create_layout.xml @@ -14,14 +14,13 @@ android:textSize="16dp" android:textColorHint="#a6a6a6" android:id="@+id/bubble_input_text" - android:paddingRight="60dp" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginLeft="5dp" android:layout_marginRight="5dp" android:minHeight="52dp" android:gravity="left|center_vertical" - android:maxLines="3" + android:maxLines="2" android:paddingTop="3dp" android:layout_marginTop="0dp" android:inputType="textFilter|textNoSuggestions|textMultiLine" @@ -29,18 +28,6 @@ android:textCursorDrawable="@null" android:textColor="#000000"/> - - - + + android:layout_width="50dp" + android:layout_height="50dp" + android:id="@+id/messages_list_row_avatar" + android:contentDescription="" + android:layout_marginTop="8dp" + android:layout_gravity="top"/> + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:id="@+id/messages_list_row_name" + android:textSize="18dp" + android:layout_marginLeft="61dp" + android:ellipsize="end" + android:layout_marginTop="10dp" + android:maxLines="1" + android:textColor="#000000" + android:layout_marginRight="60dp" + android:layout_gravity="top"/> + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:id="@+id/messages_list_row_message" + android:textSize="15dp" + android:maxLines="1" + android:ellipsize="end" + android:textColor="#808080" + android:layout_marginLeft="61dp" + android:layout_marginTop="34dp" + android:layout_marginRight="60dp" + android:layout_gravity="top"/> - + + + - \ No newline at end of file diff --git a/TMessagesProj/src/main/res/layout/language_select_layout.xml b/TMessagesProj/src/main/res/layout/language_select_layout.xml new file mode 100644 index 000000000..d14c2951c --- /dev/null +++ b/TMessagesProj/src/main/res/layout/language_select_layout.xml @@ -0,0 +1,32 @@ + + + + + + + \ No newline at end of file diff --git a/TMessagesProj/src/main/res/values-ar/strings.xml b/TMessagesProj/src/main/res/values-ar/strings.xml index 6f548c6af..8101ba203 100644 --- a/TMessagesProj/src/main/res/values-ar/strings.xml +++ b/TMessagesProj/src/main/res/values-ar/strings.xml @@ -5,6 +5,9 @@ Telegram + العربية + Arabic + رقم هاتفك المحمول يرجى التحقق من صحة رمز بلدك وإدخال رقم هاتفك المحمول @@ -107,6 +110,7 @@ حذف المجموعة قم بالسحب للإلغاء حفظ في الجهاز + Apply localization file تم طلب محادثة سرية @@ -250,6 +254,7 @@ الأحداث اشترك صديق في تيليجرام PEBBLE + اللغة لا توجد وسائط بعد @@ -268,7 +273,7 @@ عرض كافة الوسائط حفظ في الجهاز - من + %1$d من %2$d الألبوم diff --git a/TMessagesProj/src/main/res/values-de/strings.xml b/TMessagesProj/src/main/res/values-de/strings.xml index 9f590d81d..19a295c8e 100644 --- a/TMessagesProj/src/main/res/values-de/strings.xml +++ b/TMessagesProj/src/main/res/values-de/strings.xml @@ -5,6 +5,9 @@ Telegram + Deutsch + German + Dein Telefon Bitte bestätige deine Landesvorwahl und deine Telefonnummer. @@ -107,6 +110,7 @@ Diese Gruppe löschen WISCHEN UM ABZUBRECHEN In Ordner Downloads speichern + Apply localization file Geheimen Chat angefordert @@ -250,6 +254,7 @@ EREIGNISSE Kontakt ist Telegram beigetreten PEBBLE + Sprache Noch keine geteilten Medien vorhanden @@ -268,7 +273,7 @@ Zeige alle Medien In der Galerie speichern - von + %1$d von %2$d Galerie diff --git a/TMessagesProj/src/main/res/values-es/strings.xml b/TMessagesProj/src/main/res/values-es/strings.xml index 7d199cc27..92dcea329 100644 --- a/TMessagesProj/src/main/res/values-es/strings.xml +++ b/TMessagesProj/src/main/res/values-es/strings.xml @@ -5,6 +5,9 @@ Telegram + Español + Spanish + Tu teléfono Por favor, confirma tu código de país\ne introduce tu número. @@ -107,6 +110,7 @@ Eliminar este grupo DESLIZA PARA CANCELAR Guardar en descargas + Apply localization file Chat secreto solicitado @@ -250,6 +254,7 @@ EVENTOS Un contacto se unió a Telegram PEBBLE + Idioma No hay fotos ni vídeos compartidos aún @@ -268,7 +273,7 @@ Mostrar todas las fotos y vídeos Guardar en galería - de + %1$d de %2$d Galería diff --git a/TMessagesProj/src/main/res/values-it/strings.xml b/TMessagesProj/src/main/res/values-it/strings.xml index a1812ee29..0703954a5 100644 --- a/TMessagesProj/src/main/res/values-it/strings.xml +++ b/TMessagesProj/src/main/res/values-it/strings.xml @@ -5,6 +5,9 @@ Telegram + Italiano + Italian + Il tuo telefono Conferma il prefisso della tua nazione \ne inserisci il tuo numero di telefono. @@ -45,10 +48,10 @@ In attesa che %s si colleghi… Chat segreta annullata Scambio delle chiavi di cifratura... - %s si è unito alla chat segreta. + %s si è unito alla tua chat segreta. Sei entrato nella chat segreta. Cancella cronologia - Abbandona + Elimina ed esci Nome nascosto Seleziona chat @@ -57,9 +60,9 @@ Liberi %1$s di %2$s Errore sconosciuto Errore durante l\'accesso - Non ci sono file... + Non ci sono ancora file... La dimensione del file non dovrebbe superare i %1$s - Memoria non montata + Archiviazione non montata Trasferimento USB attivo Archiviazione interna Archiviazione esterna @@ -68,10 +71,10 @@ invisibile - sta scrivendo + scrivendo… Allega - sta scrivendo - scrivono + sta scrivendo… + stanno scrivendo… e altre %d persone Hai una domanda\nsu Telegram? Scatta una foto @@ -79,42 +82,43 @@ Posizione Video Documento - Non ci sono messaggi… + Non ci sono ancora messaggi… Visualizza foto Visualizza posizione Riproduci video Messaggio inoltrato Da - Nessuno messaggio recente - persone + Nessuno recente + membri Messaggio - Invia un messaggio + Scrivi il messaggio Scarica Selezionato: CONDIVIDI LE MIE INFORMAZIONI DI CONTATTO AGGIUNGI AI CONTATTI - %s ti ha invitato a partecipare ad una chat privata. - Hai invitato %s a partecipare ad una chat segreta. - Le chat segrete: + %s ti ha mandato un invito a una chat privata. + Hai invitato %s a entrare in una chat segreta. + Chat segrete: Utilizzano la cifratura punto-punto Non lasciano traccia sui nostri server - Hanno un sistema di autodistruzione dei messaggi + Hanno un contatore di autodistruzione Non permettono l’inoltro %1$d nuovo messaggio %1$d nuovi messaggi Sei stato espulso da questo gruppo - Hai abbandonato il gruppo + Hai lasciato il gruppo Elimina questo gruppo TRASCINA PER ANNULLARE Salva in download + Apply localization file Chat segreta richiesta - Chat segreta avviata - %1$s ha impostato l\'autodistruzione dopo %2$s - Autodistruzione dopo %1$s - %1$s ha disabilitato l\'autodistruzione - Autodistruzione disabilitata + Chat segreta iniziata + %1$s imposta il contatore di autodistruzione a %2$s + Hai impostato il contatore di autodistruzione a %1$s + %1$s ha disabilitato il contatore di autodistruzione + Hai disabilitato il contatore di autodistruzione 2 secondi 5 secondi 1 minuto @@ -127,47 +131,47 @@ %1$s ti ha inviato una foto %1$s ti ha inviato un video %1$s ha condiviso un contatto con te - %1$s ti ha condiviso una posizione + %1$s ti ha inviato una posizione %1$s ti ha inviato un documento - %1$s ti ha inviato un messaggio audio + %1$s ti ha inviato dell\'audio %1$s @ %2$s: %3$s %1$s ha inviato un messaggio al gruppo %2$s %1$s ha inviato una foto al gruppo %2$s %1$s ha inviato un video al gruppo %2$s %1$s ha condiviso un contatto con il gruppo %2$s - %1$s ha condiviso la posizione con il gruppo %2$s + %1$s ha inviato una posizione al gruppo %2$s %1$s ha inviato un documento al gruppo %2$s - %1$s ha inviato un messaggio audio al gruppo %2$s - %1$s ti ha aggiunto al gruppo %2$s + %1$s ha inviato dell\'audio al gruppo %2$s + %1$s ti ha invitato nel gruppo %2$s %1$s ha modificato il nome del gruppo %2$s %1$s ha modificato la foto del gruppo %2$s - %1$s ha aggiunto %3$s al gruppo %2$s + %1$s ha invitato %3$s nel gruppo %2$s %1$s ha rimosso %3$s dal gruppo %2$s %1$s ti ha rimosso dal gruppo %2$s %1$s ha lasciato il gruppo %2$s - Anche %1$s usa Telegram! - %1$s,\nAbbiamo rilevato un accesso al tuo account da un nuovo dispositivo %2$s\n\nDispositivo: %3$s\nPosizione: %4$s\n\nSe non sei stato tu, puoi andare su Impostazioni - Termina tutte le sessioni.\n\nGrazie,\nil team di Telegram + %1$s ha iniziato a usare Telegram! + %1$s,\nAbbiamo rilevato un accesso al tuo account da un nuovo dispositivo %2$s\n\nDispositivo: %3$s\nPosizione: %4$s\n\nSe non sei stato tu, puoi andare su Impostazioni - Termina tutte le sessioni.\n\nGrazie,\nla squadra di Telegram %1$s ha aggiornato la foto del profilo - Seleziona un contatto + Seleziona contatto Ancora nessun contatto Ciao, passa a Telegram: http://telegram.org/dl2 oggi alle ieri alle alle - online - disconnesso + in linea + non in linea ultimo accesso ultimo accesso Invita amici - Chat di gruppo con... - Nome del gruppo - PERSONA + Invia messaggio a... + Immetti il nome del gruppo + MEMBRO Nome gruppo - PERSONE + MEMBRI TUTTI I CONTATTI @@ -176,8 +180,8 @@ Info gruppo MEDIA CONDIVISI IMPOSTAZIONI - Aggiungi un contatto - Abbandona il gruppo + Aggiungi membro + Elimina e lascia il gruppo Notifiche Rimuovi dal gruppo @@ -196,64 +200,65 @@ TELEFONO Inizia chat segreta Si è verificato un errore. - Impossibile creare una chat segreta con %1$s.\n\n%2$s sta usando una vecchia versione di Telegram. + Impossibile creare una chat segreta con %1$s.\n\n%2$s sta usando una vecchia versione di Telegram e deve prima aggiornarla. Chat segreta Chiave di cifratura - Autodistruzione messaggi - Non attiva + Contatore di autodistruzione + Spento 2s 5s 1m 1h 1g 1sett - Questa immagine è una visualizzazione della chiave di cifratura per questa chat segreta con ]]>%1$s]]>.
]]>Se l\'immagine è uguale sul suo telefono, la chat è sicura al 200%%.
]]>Per saperne di più, visita Telegram.org
+ Questa immagine è una visualizzazione della chiave di cifratura per questa chat segreta con ]]>%1$s]]>.
]]>Se questa immagine è uguale sul telefono di ]]>%2$s]]>, la chat è sicura al 200%%.
]]>Per saperne di più, visita Telegram.org
- Impostazioni predefinite ripristinate - Dimensione del testo + Ripristina tutte le impostazioni di notifica predefinite + Dimensione testo messaggi Fai una domanda Abilita animazioni Sblocca Tieni premuto sull’utente per sbloccarlo. - Nessun utente bloccato - IL TUO NUMERO - NOTIFICHE CHAT + Ancora nessun utente bloccato + IL TUO NUMERO DI TELEFONO + NOTIFICHE MESSAGGI Avviso Anteprima messaggio - NOTIFICHE CHAT DI GRUPPO - Tono notifiche + NOTIFICHE DI GRUPPO + Suoni NOTIFICHE IN-APP Suoni in-app Vibrazione in-app Vibrazione Anteprima in-app RIPRISTINA - Ripristina notifiche + Ripristina tutte le notifiche Annulla tutte le impostazioni di notifica personalizzate per tutti i tuoi contatti e gruppi - Notifiche e toni + Notifiche e suoni Utenti bloccati Salva foto ricevute Disconnetti - I TUOI DATI - Nessuno + IL TUO NOME E COGNOME + Nessun suono Predefinito SUPPORTO Sfondo chat MESSAGGI - Usa invio per inoltrare il messaggio - Termina tutte le sessioni - SCARICA AUTOMATICAMENTE LE FOTO - SCARICAMENTO AUDIO AUTOMATICO - Chat di gruppo + Spedisci con Invio + Chiudi tutte le altre sessioni + SCARICAMENTO AUTOMATICO FOTO + SCARICAMENTO AUTOMATICO AUDIO + Gruppi Chat private EVENTI - Un nuovo contatto utilizza Telegram + Un contatto si è collegato a Telegram PEBBLE + Lingua Nessun media condiviso - Annulla download + Annulla scaricamento La mia posizione @@ -266,9 +271,9 @@ Condividi posizione - Mostra tutti i media + Mostra tutti i file media Salva nella galleria - di + %1$d di %2$d Galleria @@ -294,18 +299,18 @@ un1 ha rimosso un2 - un1 ha abbandonato il gruppo + un1 ha lasciato il gruppo un1 ha aggiunto un2 un1 ha rimosso la foto del gruppo - un1 ha modificato la foto del gruppo - un1 ha modificato il nome del gruppo in un2 + un1 ha cambiato la foto del gruppo + un1 ha cambiato il nome del gruppo in un2 un1 ha creato il gruppo Hai rimosso un2 - Hai abbandonato il gruppo + Hai lasciato il gruppo Hai aggiunto un2 Hai rimosso la foto del gruppo - Hai modificato la foto del gruppo - Hai modificato il nome del gruppo in un2 + Hai cambiato la foto del gruppo + Hai cambiato il nome del gruppo in un2 Hai creato il gruppo un1 ti ha rimosso un1 ti ha aggiunto @@ -326,14 +331,14 @@ Nome non valido Cognome non valido Caricamento… - Non hai nessun lettore video, per favore installane uno per continuare + Non hai un lettore video, per favore installane uno per continuare Non hai nessuna applicazione che può gestire il tipo mime \'%1$s\', installane una per continuare - Questo utente non usa Telegram, vuoi invitarlo? + Questo utente non ha ancora Telegram, vuoi invitarlo? Sei sicuro? - Desideri aggiungere il contatto? - Desideri aggiungere %1$s al gruppo? - Desideri inoltrare il messaggio a %1$s? - Desideri eliminare la chat? + Vuoi aggiungere il contatto? + Vuoi aggiungere %1$s al gruppo? + Vuoi inoltrare i messaggi a %1$s? + Vuoi eliminare questa chat? Telegram @@ -345,8 +350,8 @@ Privato Benvenuto nell\'era della messaggistica veloce e sicura Telegram]]> consegna i messaggi più velocemente di qualsiasi altra applicazione - Telegram]]> è gratuito per sempre. Nessuna pubblicità. Nessun costo di abbonamento - Telegram]]> tiene al sicuro i tuoi messaggi da attacchi hacker + Telegram]]> è gratuita per sempre. Nessuna pubblicità. Nessun costo di abbonamento + Telegram]]> tiene al sicuro i tuoi messaggi dagli attacchi dei hacker Telegram]]> non ha limiti sulle dimensioni dei tuoi file multimediali e delle chat Telegram]]> ti consente di accedere ai messaggi da più dispositivi Telegram]]> cifra in maniera sicura i messaggi e può far sì che si autodistruggano diff --git a/TMessagesProj/src/main/res/values-nl/strings.xml b/TMessagesProj/src/main/res/values-nl/strings.xml index f6e91d83a..6e04af471 100644 --- a/TMessagesProj/src/main/res/values-nl/strings.xml +++ b/TMessagesProj/src/main/res/values-nl/strings.xml @@ -5,6 +5,9 @@ Telegram + Nederlands + Dutch + Uw telefoon Bevestig uw landcode\nen voer uw telefoonnummer in. @@ -107,6 +110,7 @@ Deze groep verwijderen SLEEP OM TE ANNULEREN Opslaan in downloads + Apply localization file Privégesprek aangevraagd @@ -250,6 +254,7 @@ GEBEURTENISSEN Contact lid geworden van Telegram PEBBLE + Taal Nog geen media gedeeld @@ -268,7 +273,7 @@ Alle media weergeven Opslaan in galerij - van + %1$d van %1$d Galerij diff --git a/TMessagesProj/src/main/res/values/strings.xml b/TMessagesProj/src/main/res/values/strings.xml index 429138bed..700c6c733 100644 --- a/TMessagesProj/src/main/res/values/strings.xml +++ b/TMessagesProj/src/main/res/values/strings.xml @@ -5,6 +5,9 @@ Telegram + English + English + Your phone Please confirm your country code\nand enter your phone number. @@ -107,6 +110,7 @@ Delete this group SLIDE TO CANCEL Save to downloads + Apply localization file Secret chat requested @@ -250,6 +254,7 @@ EVENTS Contact joined Telegram PEBBLE + Language No shared media yet @@ -268,7 +273,7 @@ Show all media Save to gallery - of + %1$d of %2$d Gallery