Bug fixes
|
@ -80,7 +80,7 @@ android {
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 8
|
minSdkVersion 8
|
||||||
targetSdkVersion 21
|
targetSdkVersion 21
|
||||||
versionCode 388
|
versionCode 391
|
||||||
versionName "2.0.1"
|
versionName "2.0.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1616,6 +1616,7 @@ public class ContactsController {
|
||||||
|
|
||||||
public void reloadContactsStatuses() {
|
public void reloadContactsStatuses() {
|
||||||
saveContactsLoadTime();
|
saveContactsLoadTime();
|
||||||
|
MessagesController.getInstance().clearFullUsers();
|
||||||
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE);
|
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE);
|
||||||
final SharedPreferences.Editor editor = preferences.edit();
|
final SharedPreferences.Editor editor = preferences.edit();
|
||||||
editor.putBoolean("needGetStatuses", true).commit();
|
editor.putBoolean("needGetStatuses", true).commit();
|
||||||
|
|
|
@ -68,6 +68,8 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||||
private boolean startingSecretChat = false;
|
private boolean startingSecretChat = false;
|
||||||
private ArrayList<Integer> loadingFullUsers = new ArrayList<Integer>();
|
private ArrayList<Integer> loadingFullUsers = new ArrayList<Integer>();
|
||||||
private ArrayList<Integer> loadedFullUsers = new ArrayList<Integer>();
|
private ArrayList<Integer> loadedFullUsers = new ArrayList<Integer>();
|
||||||
|
private ArrayList<Integer> loadingFullChats = new ArrayList<Integer>();
|
||||||
|
private ArrayList<Integer> loadedFullChats = new ArrayList<Integer>();
|
||||||
|
|
||||||
private HashMap<Integer, ArrayList<TLRPC.TL_decryptedMessageHolder>> secretHolesQueue = new HashMap<Integer, ArrayList<TLRPC.TL_decryptedMessageHolder>>();
|
private HashMap<Integer, ArrayList<TLRPC.TL_decryptedMessageHolder>> secretHolesQueue = new HashMap<Integer, ArrayList<TLRPC.TL_decryptedMessageHolder>>();
|
||||||
|
|
||||||
|
@ -323,6 +325,8 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||||
sendingTypings.clear();
|
sendingTypings.clear();
|
||||||
loadingFullUsers.clear();
|
loadingFullUsers.clear();
|
||||||
loadedFullUsers.clear();
|
loadedFullUsers.clear();
|
||||||
|
loadingFullUsers.clear();
|
||||||
|
loadedFullUsers.clear();
|
||||||
secretHolesQueue.clear();
|
secretHolesQueue.clear();
|
||||||
|
|
||||||
updatesStartWaitTime = 0;
|
updatesStartWaitTime = 0;
|
||||||
|
@ -470,6 +474,55 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||||
loadingFullUsers.remove((Integer) uid);
|
loadingFullUsers.remove((Integer) uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void cancelLoadFullChat(int cid) {
|
||||||
|
loadingFullChats.remove((Integer) cid);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void clearFullUsers() {
|
||||||
|
loadedFullUsers.clear();
|
||||||
|
loadedFullChats.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loadFullChat(final int chat_id, final int classGuid) {
|
||||||
|
if (loadingFullChats.contains(chat_id) || loadedFullChats.contains(chat_id)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
loadingFullChats.add(chat_id);
|
||||||
|
TLRPC.TL_messages_getFullChat req = new TLRPC.TL_messages_getFullChat();
|
||||||
|
req.chat_id = chat_id;
|
||||||
|
long reqId = ConnectionsManager.getInstance().performRpc(req, new RPCRequest.RPCRequestDelegate() {
|
||||||
|
@Override
|
||||||
|
public void run(TLObject response, TLRPC.TL_error error) {
|
||||||
|
if (error == null) {
|
||||||
|
final TLRPC.TL_messages_chatFull res = (TLRPC.TL_messages_chatFull) response;
|
||||||
|
MessagesStorage.getInstance().putUsersAndChats(res.users, res.chats, true, true);
|
||||||
|
MessagesStorage.getInstance().updateChatInfo(chat_id, res.full_chat.participants, false);
|
||||||
|
AndroidUtilities.runOnUIThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
loadingFullChats.remove((Integer)chat_id);
|
||||||
|
loadedFullChats.add(chat_id);
|
||||||
|
|
||||||
|
putUsers(res.users, false);
|
||||||
|
putChats(res.chats, false);
|
||||||
|
NotificationCenter.getInstance().postNotificationName(NotificationCenter.chatInfoDidLoaded, chat_id, res.full_chat.participants);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
AndroidUtilities.runOnUIThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
loadingFullChats.remove((Integer) chat_id);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (classGuid != 0) {
|
||||||
|
ConnectionsManager.getInstance().bindRequestToGuid(reqId, classGuid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void loadFullUser(final TLRPC.User user, final int classGuid) {
|
public void loadFullUser(final TLRPC.User user, final int classGuid) {
|
||||||
if (user == null || loadingFullUsers.contains(user.id) || loadedFullUsers.contains(user.id)) {
|
if (user == null || loadingFullUsers.contains(user.id) || loadedFullUsers.contains(user.id)) {
|
||||||
return;
|
return;
|
||||||
|
@ -1089,29 +1142,10 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
public void processChatInfo(final int chat_id, final TLRPC.ChatParticipants info, final ArrayList<TLRPC.User> usersArr, final boolean fromCache) {
|
public void processChatInfo(final int chat_id, final TLRPC.ChatParticipants info, final ArrayList<TLRPC.User> usersArr, final boolean fromCache) {
|
||||||
if (info == null && fromCache) {
|
if (fromCache && chat_id > 0) {
|
||||||
TLRPC.TL_messages_getFullChat req = new TLRPC.TL_messages_getFullChat();
|
loadFullChat(chat_id, 0);
|
||||||
req.chat_id = chat_id;
|
}
|
||||||
ConnectionsManager.getInstance().performRpc(req, new RPCRequest.RPCRequestDelegate() {
|
if (info != null) {
|
||||||
@Override
|
|
||||||
public void run(TLObject response, TLRPC.TL_error error) {
|
|
||||||
if (error != null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
final TLRPC.TL_messages_chatFull res = (TLRPC.TL_messages_chatFull) response;
|
|
||||||
MessagesStorage.getInstance().putUsersAndChats(res.users, res.chats, true, true);
|
|
||||||
MessagesStorage.getInstance().updateChatInfo(chat_id, res.full_chat.participants, false);
|
|
||||||
AndroidUtilities.runOnUIThread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
putUsers(res.users, false);
|
|
||||||
putChats(res.chats, false);
|
|
||||||
NotificationCenter.getInstance().postNotificationName(NotificationCenter.chatInfoDidLoaded, chat_id, res.full_chat.participants);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
AndroidUtilities.runOnUIThread(new Runnable() {
|
AndroidUtilities.runOnUIThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
|
@ -18,6 +18,7 @@ import org.telegram.messenger.Utilities;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class PhotoObject {
|
public class PhotoObject {
|
||||||
|
|
||||||
public TLRPC.PhotoSize photoOwner;
|
public TLRPC.PhotoSize photoOwner;
|
||||||
public Bitmap image;
|
public Bitmap image;
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ public class ActionBarLayout extends FrameLayout {
|
||||||
if (view == child) {
|
if (view == child) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (view instanceof ActionBar) {
|
if (view instanceof ActionBar && view.getVisibility() == VISIBLE) {
|
||||||
actionBarHeight = view.getMeasuredHeight();
|
actionBarHeight = view.getMeasuredHeight();
|
||||||
wasActionBar = true;
|
wasActionBar = true;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -67,6 +67,7 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD
|
||||||
private int photoWidth;
|
private int photoWidth;
|
||||||
private int photoHeight;
|
private int photoHeight;
|
||||||
private PhotoObject currentPhotoObject;
|
private PhotoObject currentPhotoObject;
|
||||||
|
private PhotoObject currentPhotoObjectThumb;
|
||||||
private String currentUrl;
|
private String currentUrl;
|
||||||
private String currentPhotoFilter;
|
private String currentPhotoFilter;
|
||||||
private ImageReceiver photoImage;
|
private ImageReceiver photoImage;
|
||||||
|
@ -174,6 +175,7 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD
|
||||||
if (photoImage != null) {
|
if (photoImage != null) {
|
||||||
photoImage.clearImage();
|
photoImage.clearImage();
|
||||||
currentPhotoObject = null;
|
currentPhotoObject = null;
|
||||||
|
currentPhotoObjectThumb = null;
|
||||||
}
|
}
|
||||||
currentUrl = null;
|
currentUrl = null;
|
||||||
if (gifDrawable != null) {
|
if (gifDrawable != null) {
|
||||||
|
@ -413,6 +415,7 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD
|
||||||
buttonState = -1;
|
buttonState = -1;
|
||||||
gifDrawable = null;
|
gifDrawable = null;
|
||||||
currentPhotoObject = null;
|
currentPhotoObject = null;
|
||||||
|
currentPhotoObjectThumb = null;
|
||||||
currentUrl = null;
|
currentUrl = null;
|
||||||
photoNotSet = false;
|
photoNotSet = false;
|
||||||
|
|
||||||
|
@ -527,6 +530,9 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD
|
||||||
}
|
}
|
||||||
|
|
||||||
currentPhotoObject = PhotoObject.getClosestImageWithSize(messageObject.photoThumbs, AndroidUtilities.getPhotoSize());
|
currentPhotoObject = PhotoObject.getClosestImageWithSize(messageObject.photoThumbs, AndroidUtilities.getPhotoSize());
|
||||||
|
if (messageObject.type == 1) {
|
||||||
|
currentPhotoObjectThumb = PhotoObject.getClosestImageWithSize(messageObject.photoThumbs, 80);
|
||||||
|
}
|
||||||
if (currentPhotoObject != null) {
|
if (currentPhotoObject != null) {
|
||||||
boolean noSize = false;
|
boolean noSize = false;
|
||||||
if (currentMessageObject.type == 3 || currentMessageObject.type == 8) {
|
if (currentMessageObject.type == 3 || currentMessageObject.type == 8) {
|
||||||
|
@ -609,7 +615,11 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
photoNotSet = true;
|
photoNotSet = true;
|
||||||
photoImage.setImageBitmap(messageObject.imagePreview);
|
if (messageObject.imagePreview != null) {
|
||||||
|
photoImage.setImageBitmap(messageObject.imagePreview);
|
||||||
|
} else if (currentPhotoObjectThumb != null) {
|
||||||
|
photoImage.setImage(currentPhotoObjectThumb.photoOwner.location, currentPhotoFilter, null, 0, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -11,6 +11,7 @@ package org.telegram.ui.Cells;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
|
import android.os.Build;
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
@ -74,6 +75,10 @@ public class TextCheckCell extends FrameLayoutFixed {
|
||||||
|
|
||||||
public void setTextAndCheck(String text, boolean checked, boolean divider) {
|
public void setTextAndCheck(String text, boolean checked, boolean divider) {
|
||||||
textView.setText(text);
|
textView.setText(text);
|
||||||
|
if (Build.VERSION.SDK_INT < 11) {
|
||||||
|
checkBox.resetLayout();
|
||||||
|
checkBox.requestLayout();
|
||||||
|
}
|
||||||
checkBox.setChecked(checked);
|
checkBox.setChecked(checked);
|
||||||
needDivider = divider;
|
needDivider = divider;
|
||||||
setWillNotDraw(!divider);
|
setWillNotDraw(!divider);
|
||||||
|
|
|
@ -48,7 +48,7 @@ public class TextSettingsCell extends FrameLayout {
|
||||||
textView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL);
|
textView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL);
|
||||||
addView(textView);
|
addView(textView);
|
||||||
LayoutParams layoutParams = (LayoutParams) textView.getLayoutParams();
|
LayoutParams layoutParams = (LayoutParams) textView.getLayoutParams();
|
||||||
layoutParams.width = LayoutParams.WRAP_CONTENT;
|
layoutParams.width = LayoutParams.MATCH_PARENT;
|
||||||
layoutParams.height = LayoutParams.MATCH_PARENT;
|
layoutParams.height = LayoutParams.MATCH_PARENT;
|
||||||
layoutParams.leftMargin = AndroidUtilities.dp(17);
|
layoutParams.leftMargin = AndroidUtilities.dp(17);
|
||||||
layoutParams.rightMargin = AndroidUtilities.dp(17);
|
layoutParams.rightMargin = AndroidUtilities.dp(17);
|
||||||
|
@ -100,7 +100,7 @@ public class TextSettingsCell extends FrameLayout {
|
||||||
} else {
|
} else {
|
||||||
width = availableWidth;
|
width = availableWidth;
|
||||||
}
|
}
|
||||||
textView.measure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.AT_MOST), MeasureSpec.makeMeasureSpec(getMeasuredHeight(), MeasureSpec.EXACTLY));
|
textView.measure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(getMeasuredHeight(), MeasureSpec.EXACTLY));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTextColor(int color) {
|
public void setTextColor(int color) {
|
||||||
|
@ -110,6 +110,7 @@ public class TextSettingsCell extends FrameLayout {
|
||||||
public void setText(String text, boolean divider) {
|
public void setText(String text, boolean divider) {
|
||||||
textView.setText(text);
|
textView.setText(text);
|
||||||
valueTextView.setVisibility(GONE);
|
valueTextView.setVisibility(GONE);
|
||||||
|
valueImageView.setVisibility(GONE);
|
||||||
needDivider = divider;
|
needDivider = divider;
|
||||||
setWillNotDraw(!divider);
|
setWillNotDraw(!divider);
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,7 @@ import android.webkit.MimeTypeMap;
|
||||||
import android.widget.AbsListView;
|
import android.widget.AbsListView;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
@ -103,11 +104,12 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
private View bottomOverlay;
|
private View bottomOverlay;
|
||||||
private ChatAdapter chatAdapter;
|
private ChatAdapter chatAdapter;
|
||||||
private ChatActivityEnterView chatActivityEnterView;
|
private ChatActivityEnterView chatActivityEnterView;
|
||||||
private ActionBarMenuItem timeItem;
|
private ImageView timeItem;
|
||||||
|
private View timeItem2;
|
||||||
private TimerDrawable timerDrawable;
|
private TimerDrawable timerDrawable;
|
||||||
private ActionBarMenuItem menuItem;
|
private ActionBarMenuItem menuItem;
|
||||||
//private ActionBarMenuItem attachItem;
|
private ActionBarMenuItem attachItem;
|
||||||
//private ActionBarMenuItem headerItem;
|
private ActionBarMenuItem headerItem;
|
||||||
private TextView addContactItem;
|
private TextView addContactItem;
|
||||||
private LayoutListView chatListView;
|
private LayoutListView chatListView;
|
||||||
private BackupImageView avatarImageView;
|
private BackupImageView avatarImageView;
|
||||||
|
@ -123,8 +125,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
private TextView secretViewStatusTextView;
|
private TextView secretViewStatusTextView;
|
||||||
private TextView selectedMessagesCountTextView;
|
private TextView selectedMessagesCountTextView;
|
||||||
|
|
||||||
private AnimatorSetProxy runningAnimation2;
|
|
||||||
|
|
||||||
private MessageObject selectedObject;
|
private MessageObject selectedObject;
|
||||||
private MessageObject forwaringMessage;
|
private MessageObject forwaringMessage;
|
||||||
private boolean paused = true;
|
private boolean paused = true;
|
||||||
|
@ -176,7 +176,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
private int onlineCount = -1;
|
private int onlineCount = -1;
|
||||||
|
|
||||||
private CharSequence lastPrintString;
|
private CharSequence lastPrintString;
|
||||||
private TLRPC.UserStatus lastStatus;
|
private String lastStatus;
|
||||||
|
|
||||||
private long chatEnterTime = 0;
|
private long chatEnterTime = 0;
|
||||||
private long chatLeaveTime = 0;
|
private long chatLeaveTime = 0;
|
||||||
|
@ -367,58 +367,22 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAttachButtonHidden() {
|
public void onAttachButtonHidden() {
|
||||||
/*if (runningAnimation2 != null) {
|
if (attachItem != null) {
|
||||||
runningAnimation2.cancel();
|
attachItem.setVisibility(View.VISIBLE);
|
||||||
runningAnimation2 = null;
|
}
|
||||||
|
if (headerItem != null) {
|
||||||
|
headerItem.setVisibility(View.INVISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
attachItem.setVisibility(View.VISIBLE);
|
|
||||||
runningAnimation2 = new AnimatorSetProxy();
|
|
||||||
runningAnimation2.playTogether(
|
|
||||||
ObjectAnimatorProxy.ofFloat(attachItem, "alpha", 1.0f),
|
|
||||||
ObjectAnimatorProxy.ofFloat(headerItem, "alpha", 0.0f)
|
|
||||||
//ObjectAnimatorProxy.ofFloat(attachItem, "scaleX", 1.0f),
|
|
||||||
//ObjectAnimatorProxy.ofFloat(headerItem, "scaleX", 0.0f)
|
|
||||||
);
|
|
||||||
runningAnimation2.setDuration(100);
|
|
||||||
runningAnimation2.addListener(new AnimatorListenerAdapterProxy() {
|
|
||||||
@Override
|
|
||||||
public void onAnimationEnd(Object animation) {
|
|
||||||
if (runningAnimation2.equals(animation)) {
|
|
||||||
headerItem.setVisibility(View.INVISIBLE);
|
|
||||||
headerItem.clearAnimation();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
runningAnimation2.start();*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAttachButtonShow() {
|
public void onAttachButtonShow() {
|
||||||
/*if (runningAnimation2 != null) {
|
if (attachItem != null) {
|
||||||
runningAnimation2.cancel();
|
attachItem.setVisibility(View.INVISIBLE);
|
||||||
runningAnimation2 = null;
|
}
|
||||||
|
if (headerItem != null) {
|
||||||
|
headerItem.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
headerItem.setVisibility(View.VISIBLE);
|
|
||||||
runningAnimation2 = new AnimatorSetProxy();
|
|
||||||
runningAnimation2.playTogether(
|
|
||||||
ObjectAnimatorProxy.ofFloat(attachItem, "alpha", 0.0f),
|
|
||||||
ObjectAnimatorProxy.ofFloat(headerItem, "alpha", 1.0f)
|
|
||||||
//ObjectAnimatorProxy.ofFloat(attachItem, "scaleX", 0.0f),
|
|
||||||
//ObjectAnimatorProxy.ofFloat(headerItem, "scaleX", 1.0f)
|
|
||||||
);
|
|
||||||
runningAnimation2.setDuration(100);
|
|
||||||
runningAnimation2.addListener(new AnimatorListenerAdapterProxy() {
|
|
||||||
@Override
|
|
||||||
public void onAnimationEnd(Object animation) {
|
|
||||||
if (runningAnimation2.equals(animation)) {
|
|
||||||
attachItem.setVisibility(View.INVISIBLE);
|
|
||||||
attachItem.clearAnimation();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
runningAnimation2.start();*/
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
NotificationCenter.getInstance().addObserver(this, NotificationCenter.messagesDidLoaded);
|
NotificationCenter.getInstance().addObserver(this, NotificationCenter.messagesDidLoaded);
|
||||||
|
@ -813,6 +777,33 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
layoutParams2.gravity = Gravity.TOP | Gravity.LEFT;
|
layoutParams2.gravity = Gravity.TOP | Gravity.LEFT;
|
||||||
avatarImageView.setLayoutParams(layoutParams2);
|
avatarImageView.setLayoutParams(layoutParams2);
|
||||||
|
|
||||||
|
if (currentEncryptedChat != null) {
|
||||||
|
timeItem = new ImageView(getParentActivity());
|
||||||
|
timeItem.setPadding(AndroidUtilities.dp(10), AndroidUtilities.dp(10), AndroidUtilities.dp(5), AndroidUtilities.dp(5));
|
||||||
|
timeItem.setScaleType(ImageView.ScaleType.CENTER);
|
||||||
|
avatarContainer.addView(timeItem);
|
||||||
|
timerDrawable = new TimerDrawable(getParentActivity());
|
||||||
|
|
||||||
|
layoutParams2 = (FrameLayout.LayoutParams) timeItem.getLayoutParams();
|
||||||
|
layoutParams2.width = AndroidUtilities.dp(34);
|
||||||
|
layoutParams2.height = AndroidUtilities.dp(34);
|
||||||
|
layoutParams2.topMargin = AndroidUtilities.dp(18);
|
||||||
|
layoutParams2.leftMargin = AndroidUtilities.dp(16);
|
||||||
|
layoutParams2.gravity = Gravity.TOP | Gravity.LEFT;
|
||||||
|
timeItem.setLayoutParams(layoutParams2);
|
||||||
|
timeItem.setImageDrawable(timerDrawable);
|
||||||
|
|
||||||
|
timeItem.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
if (getParentActivity() == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
showAlertDialog(AndroidUtilities.buildTTLAlert(getParentActivity(), currentEncryptedChat));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
nameTextView = new TextView(getParentActivity());
|
nameTextView = new TextView(getParentActivity());
|
||||||
nameTextView.setTextColor(0xffffffff);
|
nameTextView.setTextColor(0xffffffff);
|
||||||
nameTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
|
nameTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
|
||||||
|
@ -858,35 +849,31 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
|
|
||||||
ActionBarMenu menu = actionBar.createMenu();
|
ActionBarMenu menu = actionBar.createMenu();
|
||||||
|
|
||||||
|
headerItem = menu.addItem(0, R.drawable.ic_ab_other);
|
||||||
|
if (currentUser != null) {
|
||||||
|
addContactItem = headerItem.addSubItem(share_contact, "", 0);
|
||||||
|
}
|
||||||
if (currentEncryptedChat != null) {
|
if (currentEncryptedChat != null) {
|
||||||
timeItem = menu.addItem(chat_enc_timer, timerDrawable = new TimerDrawable(getParentActivity()));
|
timeItem2 = headerItem.addSubItem(chat_enc_timer, LocaleController.getString("MessageLifetime", R.string.MessageLifetime), 0);
|
||||||
//headerItem = timeItem;
|
}
|
||||||
|
headerItem.addSubItem(clear_history, LocaleController.getString("ClearHistory", R.string.ClearHistory), 0);
|
||||||
|
if (currentChat != null && !isBroadcast) {
|
||||||
|
headerItem.addSubItem(delete_chat, LocaleController.getString("DeleteAndExit", R.string.DeleteAndExit), 0);
|
||||||
} else {
|
} else {
|
||||||
ActionBarMenuItem item = menu.addItem(0, R.drawable.ic_ab_other);
|
headerItem.addSubItem(delete_chat, LocaleController.getString("DeleteChatUser", R.string.DeleteChatUser), 0);
|
||||||
if (currentUser != null) {
|
|
||||||
addContactItem = item.addSubItem(share_contact, "", 0);
|
|
||||||
}
|
|
||||||
item.addSubItem(clear_history, LocaleController.getString("ClearHistory", R.string.ClearHistory), 0);
|
|
||||||
if (currentChat != null && !isBroadcast) {
|
|
||||||
item.addSubItem(delete_chat, LocaleController.getString("DeleteAndExit", R.string.DeleteAndExit), 0);
|
|
||||||
} else {
|
|
||||||
item.addSubItem(delete_chat, LocaleController.getString("DeleteChatUser", R.string.DeleteChatUser), 0);
|
|
||||||
}
|
|
||||||
//headerItem = item;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) headerItem.getLayoutParams();
|
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) headerItem.getLayoutParams();
|
||||||
layoutParams.rightMargin = AndroidUtilities.dp(-48);
|
layoutParams.rightMargin = AndroidUtilities.dp(-48);
|
||||||
headerItem.setLayoutParams(layoutParams);
|
headerItem.setLayoutParams(layoutParams);
|
||||||
|
|
||||||
attachItem = menu.addItem(chat_menu_attach, R.drawable.ic_ab_attach3);
|
attachItem = menu.addItem(chat_menu_attach, R.drawable.ic_ab_other);
|
||||||
attachItem.addSubItem(attach_photo, LocaleController.getString("ChatTakePhoto", R.string.ChatTakePhoto), R.drawable.ic_attach_photo);
|
attachItem.addSubItem(attach_photo, LocaleController.getString("ChatTakePhoto", R.string.ChatTakePhoto), R.drawable.ic_attach_photo);
|
||||||
attachItem.addSubItem(attach_gallery, LocaleController.getString("ChatGallery", R.string.ChatGallery), R.drawable.ic_attach_gallery);
|
attachItem.addSubItem(attach_gallery, LocaleController.getString("ChatGallery", R.string.ChatGallery), R.drawable.ic_attach_gallery);
|
||||||
attachItem.addSubItem(attach_video, LocaleController.getString("ChatVideo", R.string.ChatVideo), R.drawable.ic_attach_video);
|
attachItem.addSubItem(attach_video, LocaleController.getString("ChatVideo", R.string.ChatVideo), R.drawable.ic_attach_video);
|
||||||
attachItem.addSubItem(attach_document, LocaleController.getString("ChatDocument", R.string.ChatDocument), R.drawable.ic_ab_doc);
|
attachItem.addSubItem(attach_document, LocaleController.getString("ChatDocument", R.string.ChatDocument), R.drawable.ic_ab_doc);
|
||||||
attachItem.addSubItem(attach_location, LocaleController.getString("ChatLocation", R.string.ChatLocation), R.drawable.ic_attach_location);
|
attachItem.addSubItem(attach_location, LocaleController.getString("ChatLocation", R.string.ChatLocation), R.drawable.ic_attach_location);
|
||||||
ViewProxy.setPivotX(attachItem, AndroidUtilities.dp(48));
|
attachItem.setVisibility(View.INVISIBLE);
|
||||||
ViewProxy.setPivotX(headerItem, 0);*/
|
|
||||||
|
|
||||||
menuItem = menu.addItem(chat_menu_attach, R.drawable.ic_ab_attach);
|
menuItem = menu.addItem(chat_menu_attach, R.drawable.ic_ab_attach);
|
||||||
menuItem.addSubItem(attach_photo, LocaleController.getString("ChatTakePhoto", R.string.ChatTakePhoto), R.drawable.ic_attach_photo);
|
menuItem.addSubItem(attach_photo, LocaleController.getString("ChatTakePhoto", R.string.ChatTakePhoto), R.drawable.ic_attach_photo);
|
||||||
|
@ -918,7 +905,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
actionMode.addView(selectedMessagesCountTextView);
|
actionMode.addView(selectedMessagesCountTextView);
|
||||||
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams)selectedMessagesCountTextView.getLayoutParams();
|
layoutParams = (LinearLayout.LayoutParams)selectedMessagesCountTextView.getLayoutParams();
|
||||||
layoutParams.weight = 1;
|
layoutParams.weight = 1;
|
||||||
layoutParams.width = 0;
|
layoutParams.width = 0;
|
||||||
layoutParams.height = LinearLayout.LayoutParams.MATCH_PARENT;
|
layoutParams.height = LinearLayout.LayoutParams.MATCH_PARENT;
|
||||||
|
@ -992,7 +979,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
((SizeNotifierRelativeLayout) contentView).setBackgroundImage(R.drawable.background_hd);
|
((SizeNotifierRelativeLayout) contentView).setBackgroundImage(R.drawable.background_hd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Throwable e) {
|
||||||
contentView.setBackgroundColor(-2693905);
|
contentView.setBackgroundColor(-2693905);
|
||||||
chatListView.setCacheColorHint(-2693905);
|
chatListView.setCacheColorHint(-2693905);
|
||||||
FileLog.e("tmessages", e);
|
FileLog.e("tmessages", e);
|
||||||
|
@ -1380,21 +1367,25 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
if (menuItem != null) {
|
if (menuItem != null) {
|
||||||
menuItem.setVisibility(View.GONE);
|
menuItem.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (timeItem != null) {
|
if (timeItem != null) {
|
||||||
timeItem.setVisibility(View.GONE);
|
timeItem.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
if (timeItem2 != null) {
|
||||||
|
timeItem2.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (menuItem != null) {
|
if (menuItem != null) {
|
||||||
menuItem.setVisibility(View.VISIBLE);
|
menuItem.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (timeItem != null) {
|
if (timeItem != null) {
|
||||||
timeItem.setVisibility(View.VISIBLE);
|
timeItem.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
if (timeItem2 != null) {
|
||||||
|
timeItem2.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (timeItem != null) {
|
if (timerDrawable != null) {
|
||||||
timerDrawable.setTime(currentEncryptedChat.ttl);
|
timerDrawable.setTime(currentEncryptedChat.ttl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1624,9 +1615,10 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
currentUser = user;
|
currentUser = user;
|
||||||
}
|
}
|
||||||
if (lastPrintString != null || lastStatus != user.status || lastStatus != null && user.status != null && lastStatus.expires != user.status.expires) {
|
String newStatus = LocaleController.formatUserStatus(currentUser);
|
||||||
lastStatus = user.status;
|
if (lastStatus == null || lastPrintString != null || lastStatus != null && !lastStatus.equals(newStatus)) {
|
||||||
onlineTextView.setText(LocaleController.formatUserStatus(currentUser));
|
lastStatus = newStatus;
|
||||||
|
onlineTextView.setText(newStatus);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lastPrintString = null;
|
lastPrintString = null;
|
||||||
|
@ -2936,20 +2928,22 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
}
|
}
|
||||||
actionBar.showActionMode();
|
actionBar.showActionMode();
|
||||||
|
|
||||||
AnimatorSetProxy animatorSet = new AnimatorSetProxy();
|
if (Build.VERSION.SDK_INT >= 11) {
|
||||||
ArrayList<Object> animators = new ArrayList<Object>();
|
AnimatorSetProxy animatorSet = new AnimatorSetProxy();
|
||||||
for (int a = 0; a < actionModeViews.size(); a++) {
|
ArrayList<Object> animators = new ArrayList<Object>();
|
||||||
View view = actionModeViews.get(a);
|
for (int a = 0; a < actionModeViews.size(); a++) {
|
||||||
AndroidUtilities.clearDrawableAnimation(view);
|
View view = actionModeViews.get(a);
|
||||||
if (a < 1) {
|
AndroidUtilities.clearDrawableAnimation(view);
|
||||||
animators.add(ObjectAnimatorProxy.ofFloat(view, "translationX", -AndroidUtilities.dp(56), 0));
|
if (a < 1) {
|
||||||
} else {
|
animators.add(ObjectAnimatorProxy.ofFloat(view, "translationX", -AndroidUtilities.dp(56), 0));
|
||||||
animators.add(ObjectAnimatorProxy.ofFloat(view, "scaleY", 0.1f, 1.0f));
|
} else {
|
||||||
|
animators.add(ObjectAnimatorProxy.ofFloat(view, "scaleY", 0.1f, 1.0f));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
animatorSet.playTogether(animators);
|
||||||
|
animatorSet.setDuration(250);
|
||||||
|
animatorSet.start();
|
||||||
}
|
}
|
||||||
animatorSet.playTogether(animators);
|
|
||||||
animatorSet.setDuration(250);
|
|
||||||
animatorSet.start();
|
|
||||||
|
|
||||||
addToSelectedMessages(message);
|
addToSelectedMessages(message);
|
||||||
updateActionModeTitle();
|
updateActionModeTitle();
|
||||||
|
|
|
@ -12,6 +12,7 @@ import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.MotionEvent;
|
||||||
import android.view.Surface;
|
import android.view.Surface;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
@ -69,6 +70,13 @@ public class IdenticonActivity extends BaseFragment {
|
||||||
TLRPC.User user = MessagesController.getInstance().getUser(encryptedChat.user_id);
|
TLRPC.User user = MessagesController.getInstance().getUser(encryptedChat.user_id);
|
||||||
textView.setText(Html.fromHtml(LocaleController.formatString("EncryptionKeyDescription", R.string.EncryptionKeyDescription, user.first_name, user.first_name)));
|
textView.setText(Html.fromHtml(LocaleController.formatString("EncryptionKeyDescription", R.string.EncryptionKeyDescription, user.first_name, user.first_name)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fragmentView.setOnTouchListener(new View.OnTouchListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onTouch(View v, MotionEvent event) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
ViewGroup parent = (ViewGroup)fragmentView.getParent();
|
ViewGroup parent = (ViewGroup)fragmentView.getParent();
|
||||||
if (parent != null) {
|
if (parent != null) {
|
||||||
|
|
|
@ -654,7 +654,7 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
|
||||||
actionBarLayout.presentFragment(new SettingsActivity(), false, true, true);
|
actionBarLayout.presentFragment(new SettingsActivity(), false, true, true);
|
||||||
drawerLayoutContainer.setAllowOpenDrawer(false);
|
drawerLayoutContainer.setAllowOpenDrawer(false);
|
||||||
if (AndroidUtilities.isTablet()) {
|
if (AndroidUtilities.isTablet()) {
|
||||||
layersActionBarLayout.showLastFragment();
|
actionBarLayout.showLastFragment();
|
||||||
rightActionBarLayout.showLastFragment();
|
rightActionBarLayout.showLastFragment();
|
||||||
}
|
}
|
||||||
pushOpened = true;
|
pushOpened = true;
|
||||||
|
|
|
@ -1272,12 +1272,13 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
if (!init) {
|
if (!init) {
|
||||||
currentThumb = null;
|
currentThumb = null;
|
||||||
}
|
}
|
||||||
placeProvider.willSwitchFromPhoto(currentMessageObject, currentFileLocation, currentIndex);
|
|
||||||
int prevIndex = currentIndex;
|
|
||||||
currentIndex = index;
|
|
||||||
currentFileNames[0] = getFileName(index);
|
currentFileNames[0] = getFileName(index);
|
||||||
currentFileNames[1] = getFileName(index + 1);
|
currentFileNames[1] = getFileName(index + 1);
|
||||||
currentFileNames[2] = getFileName(index - 1);
|
currentFileNames[2] = getFileName(index - 1);
|
||||||
|
placeProvider.willSwitchFromPhoto(currentMessageObject, currentFileLocation, currentIndex);
|
||||||
|
int prevIndex = currentIndex;
|
||||||
|
currentIndex = index;
|
||||||
|
|
||||||
boolean sameImage = false;
|
boolean sameImage = false;
|
||||||
|
|
||||||
if (!imagesArr.isEmpty()) {
|
if (!imagesArr.isEmpty()) {
|
||||||
|
@ -1975,25 +1976,23 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
if (animationStartTime == 0) {
|
if (animationStartTime == 0) {
|
||||||
AndroidUtilities.unlockOrientation(parentActivity);
|
AndroidUtilities.unlockOrientation(parentActivity);
|
||||||
}
|
}
|
||||||
//return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ev.getPointerCount() == 1 && gestureDetector.onTouchEvent(ev) && doubleTap) {
|
if(ev.getPointerCount() == 1 && gestureDetector.onTouchEvent(ev) && doubleTap) {
|
||||||
doubleTap = false;
|
doubleTap = false;
|
||||||
moving = false;
|
moving = false;
|
||||||
zooming = false;
|
zooming = false;
|
||||||
if (animationInProgress == 0 && animationStartTime == 0) {
|
checkMinMax(false);
|
||||||
checkMinMax(false);
|
return true;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ev.getActionMasked() == MotionEvent.ACTION_DOWN || ev.getActionMasked() == MotionEvent.ACTION_POINTER_DOWN) {
|
if (ev.getActionMasked() == MotionEvent.ACTION_DOWN || ev.getActionMasked() == MotionEvent.ACTION_POINTER_DOWN) {
|
||||||
if (!scroller.isFinished()) {
|
if (!scroller.isFinished()) {
|
||||||
scroller.abortAnimation();
|
scroller.abortAnimation();
|
||||||
}
|
}
|
||||||
if (!draggingDown) {
|
if (!draggingDown && !changingPage) {
|
||||||
if (canZoom && ev.getPointerCount() == 2 && !changingPage) {
|
if (canZoom && ev.getPointerCount() == 2) {
|
||||||
pinchStartDistance = (float) Math.hypot(ev.getX(1) - ev.getX(0), ev.getY(1) - ev.getY(0));
|
pinchStartDistance = (float) Math.hypot(ev.getX(1) - ev.getX(0), ev.getY(1) - ev.getY(0));
|
||||||
pinchStartScale = scale;
|
pinchStartScale = scale;
|
||||||
pinchCenterX = (ev.getX(0) + ev.getX(1)) / 2.0f;
|
pinchCenterX = (ev.getX(0) + ev.getX(1)) / 2.0f;
|
||||||
|
@ -2040,7 +2039,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
} else if (draggingDown) {
|
} else if (draggingDown) {
|
||||||
translationY = ev.getY() - dragY;
|
translationY = ev.getY() - dragY;
|
||||||
containerView.invalidate();
|
containerView.invalidate();
|
||||||
} else if (!invalidCoords/* && animationStartTime == 0*/) {
|
} else if (!invalidCoords && animationStartTime == 0) {
|
||||||
float moveDx = moveStartX - ev.getX();
|
float moveDx = moveStartX - ev.getX();
|
||||||
float moveDy = moveStartY - ev.getY();
|
float moveDy = moveStartY - ev.getY();
|
||||||
if (moving || scale == 1 && Math.abs(moveDy) + AndroidUtilities.dp(12) < Math.abs(moveDx) || scale != 1) {
|
if (moving || scale == 1 && Math.abs(moveDy) + AndroidUtilities.dp(12) < Math.abs(moveDx) || scale != 1) {
|
||||||
|
|
|
@ -763,7 +763,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||||
if (id == NotificationCenter.updateInterfaces) {
|
if (id == NotificationCenter.updateInterfaces) {
|
||||||
int mask = (Integer)args[0];
|
int mask = (Integer)args[0];
|
||||||
if (user_id != 0) {
|
if (user_id != 0) {
|
||||||
if ((mask & MessagesController.UPDATE_MASK_AVATAR) != 0 || (mask & MessagesController.UPDATE_MASK_NAME) != 0) {
|
if ((mask & MessagesController.UPDATE_MASK_AVATAR) != 0 || (mask & MessagesController.UPDATE_MASK_NAME) != 0 || (mask & MessagesController.UPDATE_MASK_STATUS) != 0) {
|
||||||
updateProfileData();
|
updateProfileData();
|
||||||
}
|
}
|
||||||
} else if (chat_id != 0) {
|
} else if (chat_id != 0) {
|
||||||
|
@ -1042,8 +1042,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||||
photo = user.photo.photo_small;
|
photo = user.photo.photo_small;
|
||||||
photoBig = user.photo.photo_big;
|
photoBig = user.photo.photo_big;
|
||||||
}
|
}
|
||||||
AvatarDrawable avatarDrawable = new AvatarDrawable(user, true);
|
AvatarDrawable avatarDrawable = new AvatarDrawable(user);
|
||||||
avatarDrawable.setColor(0xff5c98cd);
|
|
||||||
avatarImage.setImage(photo, "50_50", avatarDrawable);
|
avatarImage.setImage(photo, "50_50", avatarDrawable);
|
||||||
|
|
||||||
nameTextView.setText(ContactsController.formatName(user.first_name, user.last_name));
|
nameTextView.setText(ContactsController.formatName(user.first_name, user.last_name));
|
||||||
|
|
|
@ -69,6 +69,7 @@ public class AvatarDrawable extends Drawable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public AvatarDrawable(TLRPC.User user, boolean profile) {
|
public AvatarDrawable(TLRPC.User user, boolean profile) {
|
||||||
|
this();
|
||||||
isProfile = profile;
|
isProfile = profile;
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
setInfo(user.id, user.first_name, user.last_name, false);
|
setInfo(user.id, user.first_name, user.last_name, false);
|
||||||
|
@ -76,6 +77,7 @@ public class AvatarDrawable extends Drawable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public AvatarDrawable(TLRPC.Chat chat, boolean profile) {
|
public AvatarDrawable(TLRPC.Chat chat, boolean profile) {
|
||||||
|
this();
|
||||||
isProfile = profile;
|
isProfile = profile;
|
||||||
if (chat != null) {
|
if (chat != null) {
|
||||||
setInfo(chat.id, chat.title, null, chat.id < 0);
|
setInfo(chat.id, chat.title, null, chat.id < 0);
|
||||||
|
|
|
@ -400,6 +400,10 @@ public class Switch extends CompoundButton {
|
||||||
wasLayout = false;
|
wasLayout = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void resetLayout() {
|
||||||
|
wasLayout = false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setChecked(boolean checked) {
|
public void setChecked(boolean checked) {
|
||||||
super.setChecked(checked);
|
super.setChecked(checked);
|
||||||
|
|
|
@ -12,7 +12,6 @@ import android.content.Context;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.ColorFilter;
|
import android.graphics.ColorFilter;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
import android.graphics.Typeface;
|
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.text.Layout;
|
import android.text.Layout;
|
||||||
import android.text.StaticLayout;
|
import android.text.StaticLayout;
|
||||||
|
@ -37,9 +36,9 @@ public class TimerDrawable extends Drawable {
|
||||||
emptyTimerDrawable = context.getResources().getDrawable(R.drawable.header_timer);
|
emptyTimerDrawable = context.getResources().getDrawable(R.drawable.header_timer);
|
||||||
timerDrawable = context.getResources().getDrawable(R.drawable.header_timer2);
|
timerDrawable = context.getResources().getDrawable(R.drawable.header_timer2);
|
||||||
timePaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
|
timePaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
|
||||||
timePaint.setTextSize(AndroidUtilities.dp(10));
|
timePaint.setTextSize(AndroidUtilities.dp(11));
|
||||||
timePaint.setColor(0xffd7e8f7);
|
timePaint.setColor(0xffffffff);
|
||||||
timePaint.setTypeface(Typeface.DEFAULT_BOLD);
|
timePaint.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,8 +89,8 @@ public class TimerDrawable extends Drawable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(Canvas canvas) {
|
public void draw(Canvas canvas) {
|
||||||
int width = getBounds().width();
|
int width = timerDrawable.getIntrinsicWidth();
|
||||||
int height = getBounds().height();
|
int height = timerDrawable.getIntrinsicHeight();
|
||||||
Drawable drawable = null;
|
Drawable drawable = null;
|
||||||
if (time == 0) {
|
if (time == 0) {
|
||||||
drawable = timerDrawable;
|
drawable = timerDrawable;
|
||||||
|
@ -105,7 +104,11 @@ public class TimerDrawable extends Drawable {
|
||||||
drawable.draw(canvas);
|
drawable.draw(canvas);
|
||||||
|
|
||||||
if (time != 0 && timeLayout != null) {
|
if (time != 0 && timeLayout != null) {
|
||||||
canvas.translate((int)(width / 2 - Math.ceil(timeWidth / 2)), (height - timeHeight) / 2 + AndroidUtilities.dpf2(1.5f));
|
int xOffxet = 0;
|
||||||
|
if (AndroidUtilities.density == 3) {
|
||||||
|
xOffxet = -1;
|
||||||
|
}
|
||||||
|
canvas.translate((int)(width / 2 - Math.ceil(timeWidth / 2)) + xOffxet, (height - timeHeight) / 2);
|
||||||
timeLayout.draw(canvas);
|
timeLayout.draw(canvas);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -127,11 +130,11 @@ public class TimerDrawable extends Drawable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getIntrinsicWidth() {
|
public int getIntrinsicWidth() {
|
||||||
return -1;
|
return timerDrawable.getIntrinsicWidth();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getIntrinsicHeight() {
|
public int getIntrinsicHeight() {
|
||||||
return -1;
|
return timerDrawable.getIntrinsicHeight();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Before Width: | Height: | Size: 1 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 698 B After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 715 B After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 2 KiB After Width: | Height: | Size: 2.3 KiB |