Commit fc8f91a3 authored by DrKLO's avatar DrKLO

Merge branch 'master' into dev

parents 8351b066 1eeb12f6
...@@ -82,7 +82,7 @@ android { ...@@ -82,7 +82,7 @@ android {
defaultConfig { defaultConfig {
minSdkVersion 8 minSdkVersion 8
targetSdkVersion 19 targetSdkVersion 19
versionCode 211 versionCode 212
versionName "1.4.8" versionName "1.4.9"
} }
} }
...@@ -22,7 +22,6 @@ import org.telegram.PhoneFormat.PhoneFormat; ...@@ -22,7 +22,6 @@ import org.telegram.PhoneFormat.PhoneFormat;
import org.telegram.messenger.LocaleController; import org.telegram.messenger.LocaleController;
import org.telegram.messenger.TLRPC; import org.telegram.messenger.TLRPC;
import org.telegram.messenger.ConnectionsManager; import org.telegram.messenger.ConnectionsManager;
import org.telegram.messenger.ContactsController;
import org.telegram.messenger.MessagesController; import org.telegram.messenger.MessagesController;
import org.telegram.messenger.R; import org.telegram.messenger.R;
import org.telegram.messenger.UserConfig; import org.telegram.messenger.UserConfig;
...@@ -296,27 +295,16 @@ public class ChatOrUserCell extends BaseCell { ...@@ -296,27 +295,16 @@ public class ChatOrUserCell extends BaseCell {
if (chat != null) { if (chat != null) {
nameString2 = chat.title; nameString2 = chat.title;
} else if (user != null) { } else if (user != null) {
if (user.id / 1000 != 333 && ContactsController.getInstance().contactsDict.get(user.id) == null) { nameString2 = Utilities.formatName(user.first_name, user.last_name);
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 (nameString.length() == 0) {
if (user.phone != null && user.phone.length() != 0) { if (user.phone != null && user.phone.length() != 0) {
nameString = PhoneFormat.getInstance().format("+" + user.phone); nameString = PhoneFormat.getInstance().format("+" + user.phone);
} else {
nameString = LocaleController.getString("HiddenName", R.string.HiddenName);
} }
nameString = LocaleController.getString("HiddenName", R.string.HiddenName);
} }
if (encryptedChat != null) { if (encryptedChat != null) {
currentNamePaint = nameEncryptedPaint; currentNamePaint = nameEncryptedPaint;
......
...@@ -47,6 +47,7 @@ public class DialogCell extends BaseCell { ...@@ -47,6 +47,7 @@ public class DialogCell extends BaseCell {
private static Drawable errorDrawable; private static Drawable errorDrawable;
private static Drawable lockDrawable; private static Drawable lockDrawable;
private static Drawable countDrawable; private static Drawable countDrawable;
private static Drawable groupDrawable;
private TLRPC.TL_dialog currentDialog; private TLRPC.TL_dialog currentDialog;
private ImageReceiver avatarImage; private ImageReceiver avatarImage;
...@@ -127,6 +128,10 @@ public class DialogCell extends BaseCell { ...@@ -127,6 +128,10 @@ public class DialogCell extends BaseCell {
countDrawable = getResources().getDrawable(R.drawable.dialogs_badge); countDrawable = getResources().getDrawable(R.drawable.dialogs_badge);
} }
if (groupDrawable == null) {
groupDrawable = getResources().getDrawable(R.drawable.grouplist);
}
if (avatarImage == null) { if (avatarImage == null) {
avatarImage = new ImageReceiver(); avatarImage = new ImageReceiver();
avatarImage.parentView = new WeakReference<View>(this); avatarImage.parentView = new WeakReference<View>(this);
...@@ -260,6 +265,9 @@ public class DialogCell extends BaseCell { ...@@ -260,6 +265,9 @@ public class DialogCell extends BaseCell {
if (cellLayout.drawNameLock) { if (cellLayout.drawNameLock) {
setDrawableBounds(lockDrawable, cellLayout.nameLockLeft, cellLayout.nameLockTop); setDrawableBounds(lockDrawable, cellLayout.nameLockLeft, cellLayout.nameLockTop);
lockDrawable.draw(canvas); lockDrawable.draw(canvas);
} else if (cellLayout.drawNameGroup) {
setDrawableBounds(groupDrawable, cellLayout.nameLockLeft, cellLayout.nameLockTop);
groupDrawable.draw(canvas);
} }
canvas.save(); canvas.save();
...@@ -313,8 +321,9 @@ public class DialogCell extends BaseCell { ...@@ -313,8 +321,9 @@ public class DialogCell extends BaseCell {
private int nameWidth; private int nameWidth;
private StaticLayout nameLayout; private StaticLayout nameLayout;
private boolean drawNameLock; private boolean drawNameLock;
private boolean drawNameGroup;
private int nameLockLeft; private int nameLockLeft;
private int nameLockTop = Utilities.dp(13); private int nameLockTop;
private int timeLeft; private int timeLeft;
private int timeTop = Utilities.dp(13); private int timeTop = Utilities.dp(13);
...@@ -359,6 +368,8 @@ public class DialogCell extends BaseCell { ...@@ -359,6 +368,8 @@ public class DialogCell extends BaseCell {
if (encryptedChat != null) { if (encryptedChat != null) {
drawNameLock = true; drawNameLock = true;
drawNameGroup = false;
nameLockTop = Utilities.dp(13);
if (!LocaleController.isRTL) { if (!LocaleController.isRTL) {
nameLockLeft = Utilities.dp(77); nameLockLeft = Utilities.dp(77);
nameLeft = Utilities.dp(81) + lockDrawable.getIntrinsicWidth(); nameLeft = Utilities.dp(81) + lockDrawable.getIntrinsicWidth();
...@@ -368,10 +379,23 @@ public class DialogCell extends BaseCell { ...@@ -368,10 +379,23 @@ public class DialogCell extends BaseCell {
} }
} else { } else {
drawNameLock = false; drawNameLock = false;
if (!LocaleController.isRTL) { if (chat != null) {
nameLeft = Utilities.dp(77); drawNameGroup = true;
nameLockTop = Utilities.dp(14);
if (!LocaleController.isRTL) {
nameLockLeft = Utilities.dp(77);
nameLeft = Utilities.dp(81) + groupDrawable.getIntrinsicWidth();
} else {
nameLockLeft = width - Utilities.dp(77) - groupDrawable.getIntrinsicWidth();
nameLeft = Utilities.dp(14);
}
} else { } else {
nameLeft = Utilities.dp(14); drawNameGroup = false;
if (!LocaleController.isRTL) {
nameLeft = Utilities.dp(77);
} else {
nameLeft = Utilities.dp(14);
}
} }
} }
...@@ -547,6 +571,8 @@ public class DialogCell extends BaseCell { ...@@ -547,6 +571,8 @@ public class DialogCell extends BaseCell {
} }
if (drawNameLock) { if (drawNameLock) {
nameWidth -= Utilities.dp(4) + lockDrawable.getIntrinsicWidth(); nameWidth -= Utilities.dp(4) + lockDrawable.getIntrinsicWidth();
} else if (drawNameGroup) {
nameWidth -= Utilities.dp(4) + groupDrawable.getIntrinsicWidth();
} }
if (drawClock) { if (drawClock) {
int w = clockDrawable.getIntrinsicWidth() + Utilities.dp(2); int w = clockDrawable.getIntrinsicWidth() + Utilities.dp(2);
......
...@@ -263,11 +263,8 @@ public class LanguageSelectActivity extends BaseFragment { ...@@ -263,11 +263,8 @@ public class LanguageSelectActivity extends BaseFragment {
searching = false; searching = false;
searchWas = false; searchWas = false;
if (listView != null) { if (listView != null) {
listView.setEmptyView(emptyTextView);
emptyTextView.setVisibility(View.GONE); emptyTextView.setVisibility(View.GONE);
} listView.setAdapter(listAdapter);
if (listAdapter != null) {
listAdapter.notifyDataSetChanged();
} }
((LaunchActivity)parentActivity).fixBackButton(); ((LaunchActivity)parentActivity).fixBackButton();
return true; return true;
......
...@@ -77,6 +77,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter ...@@ -77,6 +77,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
private int logoutRow; private int logoutRow;
private int sendLogsRow; private int sendLogsRow;
private int clearLogsRow; private int clearLogsRow;
private int switchBackendButtonRow;
private int rowCount; private int rowCount;
private int messagesSectionRow; private int messagesSectionRow;
private int sendByEnterRow; private int sendByEnterRow;
...@@ -175,6 +176,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter ...@@ -175,6 +176,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
if (BuildVars.DEBUG_VERSION) { if (BuildVars.DEBUG_VERSION) {
sendLogsRow = rowCount++; sendLogsRow = rowCount++;
clearLogsRow = rowCount++; clearLogsRow = rowCount++;
switchBackendButtonRow = rowCount++;
} }
askQuestionRow = rowCount++; askQuestionRow = rowCount++;
logoutRow = rowCount++; logoutRow = rowCount++;
...@@ -408,6 +410,18 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter ...@@ -408,6 +410,18 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
} }
} else if (i == languageRow) { } else if (i == languageRow) {
((LaunchActivity)parentActivity).presentFragment(new LanguageSelectActivity(), "settings_wallpapers", false); ((LaunchActivity)parentActivity).presentFragment(new LanguageSelectActivity(), "settings_wallpapers", false);
} else if (i == switchBackendButtonRow) {
AlertDialog.Builder builder = new AlertDialog.Builder(parentActivity);
builder.setMessage(LocaleController.getString("AreYouSure", R.string.AreYouSure));
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
ConnectionsManager.getInstance().switchBackend();
}
});
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
builder.show().setCanceledOnTouchOutside(true);
} }
// else if (i == 6) { // else if (i == 6) {
// UserConfig.saveIncomingPhotos = !UserConfig.saveIncomingPhotos; // UserConfig.saveIncomingPhotos = !UserConfig.saveIncomingPhotos;
...@@ -542,7 +556,8 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter ...@@ -542,7 +556,8 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
public boolean isEnabled(int i) { public boolean isEnabled(int i) {
return i == textSizeRow || i == enableAnimationsRow || i == blockedRow || i == notificationRow || i == backgroundRow || return i == textSizeRow || i == enableAnimationsRow || i == blockedRow || i == notificationRow || i == backgroundRow ||
i == askQuestionRow || i == sendLogsRow || i == sendByEnterRow || i == terminateSessionsRow || i == photoDownloadPrivateRow || i == askQuestionRow || i == sendLogsRow || i == sendByEnterRow || i == terminateSessionsRow || i == photoDownloadPrivateRow ||
i == photoDownloadChatRow || i == clearLogsRow || i == audioDownloadChatRow || i == audioDownloadPrivateRow || i == languageRow; i == photoDownloadChatRow || i == clearLogsRow || i == audioDownloadChatRow || i == audioDownloadPrivateRow || i == languageRow ||
i == switchBackendButtonRow;
} }
@Override @Override
...@@ -748,6 +763,9 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter ...@@ -748,6 +763,9 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
} else if (i == terminateSessionsRow) { } else if (i == terminateSessionsRow) {
textView.setText(LocaleController.getString("TerminateAllSessions", R.string.TerminateAllSessions)); textView.setText(LocaleController.getString("TerminateAllSessions", R.string.TerminateAllSessions));
divider.setVisibility(View.INVISIBLE); divider.setVisibility(View.INVISIBLE);
} else if (i == switchBackendButtonRow) {
textView.setText("Switch Backend");
divider.setVisibility(View.VISIBLE);
} }
} else if (type == 3) { } else if (type == 3) {
if (view == null) { if (view == null) {
...@@ -883,7 +901,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter ...@@ -883,7 +901,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
return 5; return 5;
} else if (i == enableAnimationsRow || i == sendByEnterRow || i == photoDownloadChatRow || i == photoDownloadPrivateRow || i == audioDownloadChatRow || i == audioDownloadPrivateRow) { } else if (i == enableAnimationsRow || i == sendByEnterRow || i == photoDownloadChatRow || i == photoDownloadPrivateRow || i == audioDownloadChatRow || i == audioDownloadPrivateRow) {
return 3; return 3;
} else if (i == numberRow || i == notificationRow || i == blockedRow || i == backgroundRow || i == askQuestionRow || i == sendLogsRow || i == terminateSessionsRow || i == clearLogsRow) { } else if (i == numberRow || i == notificationRow || i == blockedRow || i == backgroundRow || i == askQuestionRow || i == sendLogsRow || i == terminateSessionsRow || i == clearLogsRow || i == switchBackendButtonRow) {
return 2; return 2;
} else if (i == logoutRow) { } else if (i == logoutRow) {
return 4; return 4;
......
...@@ -37,15 +37,15 @@ ...@@ -37,15 +37,15 @@
android:id="@+id/chat_photo_image"/> android:id="@+id/chat_photo_image"/>
<org.telegram.ui.Views.FrameLayoutFixed <org.telegram.ui.Views.FrameLayoutFixed
android:layout_height="40dp" android:layout_height="44dp"
android:layout_width="40dp" android:layout_width="44dp"
android:id="@+id/chat_view_action_layout" android:id="@+id/chat_view_action_layout"
android:layout_gravity="center" android:layout_gravity="center"
android:visibility="visible"> android:visibility="visible">
<ImageView <ImageView
android:layout_width="40dp" android:layout_width="44dp"
android:layout_height="40dp" android:layout_height="44dp"
android:scaleType="centerInside" android:scaleType="centerInside"
android:id="@+id/chat_view_action_cancel_button" android:id="@+id/chat_view_action_cancel_button"
android:src="@drawable/photo_download_states" android:src="@drawable/photo_download_states"
......
...@@ -27,15 +27,15 @@ ...@@ -27,15 +27,15 @@
android:id="@+id/chat_photo_image"/> android:id="@+id/chat_photo_image"/>
<org.telegram.ui.Views.FrameLayoutFixed <org.telegram.ui.Views.FrameLayoutFixed
android:layout_height="40dp" android:layout_height="44dp"
android:layout_width="40dp" android:layout_width="44dp"
android:id="@+id/chat_view_action_layout" android:id="@+id/chat_view_action_layout"
android:layout_gravity="center" android:layout_gravity="center"
android:visibility="visible"> android:visibility="visible">
<ImageView <ImageView
android:layout_width="40dp" android:layout_width="44dp"
android:layout_height="40dp" android:layout_height="44dp"
android:scaleType="centerInside" android:scaleType="centerInside"
android:id="@+id/chat_view_action_cancel_button" android:id="@+id/chat_view_action_cancel_button"
android:src="@drawable/photo_download_states" android:src="@drawable/photo_download_states"
......
...@@ -151,7 +151,7 @@ ...@@ -151,7 +151,7 @@
android:layout_marginTop="2dp" android:layout_marginTop="2dp"
android:maxLines="4" android:maxLines="4"
android:minHeight="48dp" android:minHeight="48dp"
android:textSize="18dp" android:textSize="18sp"
android:textColorHint="#909090" android:textColorHint="#909090"
android:ems="10" android:ems="10"
android:imeOptions="flagNoExtractUi" android:imeOptions="flagNoExtractUi"
......
...@@ -27,15 +27,15 @@ ...@@ -27,15 +27,15 @@
android:id="@+id/chat_photo_image"/> android:id="@+id/chat_photo_image"/>
<org.telegram.ui.Views.FrameLayoutFixed <org.telegram.ui.Views.FrameLayoutFixed
android:layout_height="40dp" android:layout_height="44dp"
android:layout_width="40dp" android:layout_width="44dp"
android:id="@+id/chat_view_action_layout" android:id="@+id/chat_view_action_layout"
android:layout_gravity="center" android:layout_gravity="center"
android:visibility="visible"> android:visibility="visible">
<ImageView <ImageView
android:layout_width="40dp" android:layout_width="44dp"
android:layout_height="40dp" android:layout_height="44dp"
android:scaleType="centerInside" android:scaleType="centerInside"
android:id="@+id/chat_view_action_cancel_button" android:id="@+id/chat_view_action_cancel_button"
android:src="@drawable/photo_download_cancel_states" android:src="@drawable/photo_download_cancel_states"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment