Remove unused name-order code.

This commit is contained in:
B. Petersen
2017-04-22 21:18:22 +02:00
parent f689b2fb94
commit 9d5edba4aa
3 changed files with 1 additions and 63 deletions
@@ -122,40 +122,6 @@ public class ContactsController {
return true;
}
public static String formatName(String firstName, String lastName) {
if (firstName != null) {
firstName = firstName.trim();
}
if (lastName != null) {
lastName = lastName.trim();
}
StringBuilder result = new StringBuilder((firstName != null ? firstName.length() : 0) + (lastName != null ? lastName.length() : 0) + 1);
if (LocaleController.nameDisplayOrder == 1) {
if (firstName != null && firstName.length() > 0) {
result.append(firstName);
if (lastName != null && lastName.length() > 0) {
result.append(" ");
result.append(lastName);
}
} else if (lastName != null && lastName.length() > 0) {
result.append(lastName);
}
} else {
if (lastName != null && lastName.length() > 0) {
result.append(lastName);
if (firstName != null && firstName.length() > 0) {
result.append(" ");
result.append(firstName);
}
} else if (firstName != null && firstName.length() > 0) {
result.append(firstName);
}
}
return result.toString();
}
/* Handle contact images
**********************************************************************************************/
@@ -40,7 +40,6 @@ import java.util.TimeZone;
public class LocaleController {
public static boolean isRTL = false;
public static int nameDisplayOrder = 1;
public FastDateFormat formatterDay;
public FastDateFormat formatterWeek;
public FastDateFormat formatterMonth;
@@ -153,7 +152,6 @@ public class LocaleController {
lang = "en";
}
isRTL = lang.toLowerCase().equals("ar");
nameDisplayOrder = lang.toLowerCase().equals("ko") ? 2 : 1;
boolean is24HourFormat = DateFormat.is24HourFormat(ApplicationLoader.applicationContext);
formatterMonth = createFormatter(locale, ApplicationLoader.applicationContext.getString(R.string.formatterMonth), "dd MMM");
@@ -2087,34 +2087,8 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
}
private void measureTime(MessageObject messageObject) {
boolean hasSign = !messageObject.isOutOwner() && messageObject.messageOwner.from_id > 0 && messageObject.messageOwner.post;
TLRPC.User signUser = MrMailbox.getUser(messageObject.messageOwner.from_id);
if (hasSign && signUser == null) {
hasSign = false;
}
String timeString = LocaleController.getInstance().formatterDay.format((long) (messageObject.messageOwner.date) * 1000);
if (hasSign) {
currentTimeString = ", " + timeString;
} else {
currentTimeString = timeString;
}
currentTimeString = LocaleController.getInstance().formatterDay.format((long) (messageObject.messageOwner.date) * 1000);
timeTextWidth = timeWidth = (int) Math.ceil(timePaint.measureText(currentTimeString));
if (hasSign) {
if (availableTimeWidth == 0) {
availableTimeWidth = dp(1000);
}
CharSequence name = ContactsController.formatName(signUser.first_name, signUser.last_name).replace('\n', ' ');
int widthForSign = availableTimeWidth - timeWidth;
int width = (int) Math.ceil(timePaint.measureText(name, 0, name.length()));
if (width > widthForSign) {
name = TextUtils.ellipsize(name, timePaint, widthForSign, TextUtils.TruncateAt.END);
width = widthForSign;
}
currentTimeString = name + currentTimeString;
timeTextWidth += width;
timeWidth += width;
}
}
private boolean isDrawSelectedBackground() {