Bug fixes

This commit is contained in:
DrKLO 2014-11-19 18:17:24 +03:00
parent ba4cf583b4
commit dd61bbaa7a
24 changed files with 203 additions and 142 deletions

View File

@ -80,7 +80,7 @@ android {
defaultConfig {
minSdkVersion 8
targetSdkVersion 21
versionCode 388
versionName "2.0.1"
versionCode 391
versionName "2.0.2"
}
}

View File

@ -1616,6 +1616,7 @@ public class ContactsController {
public void reloadContactsStatuses() {
saveContactsLoadTime();
MessagesController.getInstance().clearFullUsers();
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE);
final SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("needGetStatuses", true).commit();

View File

@ -68,6 +68,8 @@ public class MessagesController implements NotificationCenter.NotificationCenter
private boolean startingSecretChat = false;
private ArrayList<Integer> loadingFullUsers = 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>>();
@ -323,6 +325,8 @@ public class MessagesController implements NotificationCenter.NotificationCenter
sendingTypings.clear();
loadingFullUsers.clear();
loadedFullUsers.clear();
loadingFullUsers.clear();
loadedFullUsers.clear();
secretHolesQueue.clear();
updatesStartWaitTime = 0;
@ -470,6 +474,55 @@ public class MessagesController implements NotificationCenter.NotificationCenter
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) {
if (user == null || loadingFullUsers.contains(user.id) || loadedFullUsers.contains(user.id)) {
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) {
if (info == null && fromCache) {
TLRPC.TL_messages_getFullChat req = new TLRPC.TL_messages_getFullChat();
req.chat_id = chat_id;
ConnectionsManager.getInstance().performRpc(req, new RPCRequest.RPCRequestDelegate() {
@Override
public void run(TLObject response, TLRPC.TL_error error) {
if (error != null) {
return;
if (fromCache && chat_id > 0) {
loadFullChat(chat_id, 0);
}
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 {
if (info != null) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public void run() {

View File

@ -18,6 +18,7 @@ import org.telegram.messenger.Utilities;
import java.util.ArrayList;
public class PhotoObject {
public TLRPC.PhotoSize photoOwner;
public Bitmap image;

View File

@ -68,7 +68,7 @@ public class ActionBarLayout extends FrameLayout {
if (view == child) {
continue;
}
if (view instanceof ActionBar) {
if (view instanceof ActionBar && view.getVisibility() == VISIBLE) {
actionBarHeight = view.getMeasuredHeight();
wasActionBar = true;
break;

View File

@ -67,6 +67,7 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD
private int photoWidth;
private int photoHeight;
private PhotoObject currentPhotoObject;
private PhotoObject currentPhotoObjectThumb;
private String currentUrl;
private String currentPhotoFilter;
private ImageReceiver photoImage;
@ -174,6 +175,7 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD
if (photoImage != null) {
photoImage.clearImage();
currentPhotoObject = null;
currentPhotoObjectThumb = null;
}
currentUrl = null;
if (gifDrawable != null) {
@ -413,6 +415,7 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD
buttonState = -1;
gifDrawable = null;
currentPhotoObject = null;
currentPhotoObjectThumb = null;
currentUrl = null;
photoNotSet = false;
@ -527,6 +530,9 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD
}
currentPhotoObject = PhotoObject.getClosestImageWithSize(messageObject.photoThumbs, AndroidUtilities.getPhotoSize());
if (messageObject.type == 1) {
currentPhotoObjectThumb = PhotoObject.getClosestImageWithSize(messageObject.photoThumbs, 80);
}
if (currentPhotoObject != null) {
boolean noSize = false;
if (currentMessageObject.type == 3 || currentMessageObject.type == 8) {
@ -609,7 +615,11 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD
}
} else {
photoNotSet = true;
if (messageObject.imagePreview != null) {
photoImage.setImageBitmap(messageObject.imagePreview);
} else if (currentPhotoObjectThumb != null) {
photoImage.setImage(currentPhotoObjectThumb.photoOwner.location, currentPhotoFilter, null, 0, true);
}
}
}
} else {

View File

@ -11,6 +11,7 @@ package org.telegram.ui.Cells;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.os.Build;
import android.util.TypedValue;
import android.view.Gravity;
import android.widget.TextView;
@ -74,6 +75,10 @@ public class TextCheckCell extends FrameLayoutFixed {
public void setTextAndCheck(String text, boolean checked, boolean divider) {
textView.setText(text);
if (Build.VERSION.SDK_INT < 11) {
checkBox.resetLayout();
checkBox.requestLayout();
}
checkBox.setChecked(checked);
needDivider = divider;
setWillNotDraw(!divider);

View File

@ -48,7 +48,7 @@ public class TextSettingsCell extends FrameLayout {
textView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL);
addView(textView);
LayoutParams layoutParams = (LayoutParams) textView.getLayoutParams();
layoutParams.width = LayoutParams.WRAP_CONTENT;
layoutParams.width = LayoutParams.MATCH_PARENT;
layoutParams.height = LayoutParams.MATCH_PARENT;
layoutParams.leftMargin = AndroidUtilities.dp(17);
layoutParams.rightMargin = AndroidUtilities.dp(17);
@ -100,7 +100,7 @@ public class TextSettingsCell extends FrameLayout {
} else {
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) {
@ -110,6 +110,7 @@ public class TextSettingsCell extends FrameLayout {
public void setText(String text, boolean divider) {
textView.setText(text);
valueTextView.setVisibility(GONE);
valueImageView.setVisibility(GONE);
needDivider = divider;
setWillNotDraw(!divider);
}

View File

@ -38,6 +38,7 @@ import android.webkit.MimeTypeMap;
import android.widget.AbsListView;
import android.widget.AdapterView;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
@ -103,11 +104,12 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
private View bottomOverlay;
private ChatAdapter chatAdapter;
private ChatActivityEnterView chatActivityEnterView;
private ActionBarMenuItem timeItem;
private ImageView timeItem;
private View timeItem2;
private TimerDrawable timerDrawable;
private ActionBarMenuItem menuItem;
//private ActionBarMenuItem attachItem;
//private ActionBarMenuItem headerItem;
private ActionBarMenuItem attachItem;
private ActionBarMenuItem headerItem;
private TextView addContactItem;
private LayoutListView chatListView;
private BackupImageView avatarImageView;
@ -123,8 +125,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
private TextView secretViewStatusTextView;
private TextView selectedMessagesCountTextView;
private AnimatorSetProxy runningAnimation2;
private MessageObject selectedObject;
private MessageObject forwaringMessage;
private boolean paused = true;
@ -176,7 +176,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
private int onlineCount = -1;
private CharSequence lastPrintString;
private TLRPC.UserStatus lastStatus;
private String lastStatus;
private long chatEnterTime = 0;
private long chatLeaveTime = 0;
@ -367,58 +367,22 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
@Override
public void onAttachButtonHidden() {
/*if (runningAnimation2 != null) {
runningAnimation2.cancel();
runningAnimation2 = null;
}
if (attachItem != null) {
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)) {
}
if (headerItem != null) {
headerItem.setVisibility(View.INVISIBLE);
headerItem.clearAnimation();
}
}
});
runningAnimation2.start();*/
}
@Override
public void onAttachButtonShow() {
/*if (runningAnimation2 != null) {
runningAnimation2.cancel();
runningAnimation2 = null;
}
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)) {
if (attachItem != null) {
attachItem.setVisibility(View.INVISIBLE);
attachItem.clearAnimation();
}
if (headerItem != null) {
headerItem.setVisibility(View.VISIBLE);
}
});
runningAnimation2.start();*/
}
});
NotificationCenter.getInstance().addObserver(this, NotificationCenter.messagesDidLoaded);
@ -813,6 +777,33 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
layoutParams2.gravity = Gravity.TOP | Gravity.LEFT;
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.setTextColor(0xffffffff);
nameTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
@ -858,35 +849,31 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
ActionBarMenu menu = actionBar.createMenu();
if (currentEncryptedChat != null) {
timeItem = menu.addItem(chat_enc_timer, timerDrawable = new TimerDrawable(getParentActivity()));
//headerItem = timeItem;
} else {
ActionBarMenuItem item = menu.addItem(0, R.drawable.ic_ab_other);
headerItem = menu.addItem(0, R.drawable.ic_ab_other);
if (currentUser != null) {
addContactItem = item.addSubItem(share_contact, "", 0);
addContactItem = headerItem.addSubItem(share_contact, "", 0);
}
item.addSubItem(clear_history, LocaleController.getString("ClearHistory", R.string.ClearHistory), 0);
if (currentEncryptedChat != null) {
timeItem2 = headerItem.addSubItem(chat_enc_timer, LocaleController.getString("MessageLifetime", R.string.MessageLifetime), 0);
}
headerItem.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);
headerItem.addSubItem(delete_chat, LocaleController.getString("DeleteAndExit", R.string.DeleteAndExit), 0);
} else {
item.addSubItem(delete_chat, LocaleController.getString("DeleteChatUser", R.string.DeleteChatUser), 0);
}
//headerItem = item;
headerItem.addSubItem(delete_chat, LocaleController.getString("DeleteChatUser", R.string.DeleteChatUser), 0);
}
/*LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) headerItem.getLayoutParams();
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) headerItem.getLayoutParams();
layoutParams.rightMargin = AndroidUtilities.dp(-48);
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_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_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);
ViewProxy.setPivotX(attachItem, AndroidUtilities.dp(48));
ViewProxy.setPivotX(headerItem, 0);*/
attachItem.setVisibility(View.INVISIBLE);
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);
@ -918,7 +905,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
});
actionMode.addView(selectedMessagesCountTextView);
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams)selectedMessagesCountTextView.getLayoutParams();
layoutParams = (LinearLayout.LayoutParams)selectedMessagesCountTextView.getLayoutParams();
layoutParams.weight = 1;
layoutParams.width = 0;
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);
}
}
} catch (Exception e) {
} catch (Throwable e) {
contentView.setBackgroundColor(-2693905);
chatListView.setCacheColorHint(-2693905);
FileLog.e("tmessages", e);
@ -1380,21 +1367,25 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (menuItem != null) {
menuItem.setVisibility(View.GONE);
}
if (timeItem != null) {
timeItem.setVisibility(View.GONE);
}
if (timeItem2 != null) {
timeItem2.setVisibility(View.GONE);
}
} else {
if (menuItem != null) {
menuItem.setVisibility(View.VISIBLE);
}
if (timeItem != null) {
timeItem.setVisibility(View.VISIBLE);
}
if (timeItem2 != null) {
timeItem2.setVisibility(View.VISIBLE);
}
}
if (timeItem != null) {
if (timerDrawable != null) {
timerDrawable.setTime(currentEncryptedChat.ttl);
}
@ -1624,9 +1615,10 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (user != null) {
currentUser = user;
}
if (lastPrintString != null || lastStatus != user.status || lastStatus != null && user.status != null && lastStatus.expires != user.status.expires) {
lastStatus = user.status;
onlineTextView.setText(LocaleController.formatUserStatus(currentUser));
String newStatus = LocaleController.formatUserStatus(currentUser);
if (lastStatus == null || lastPrintString != null || lastStatus != null && !lastStatus.equals(newStatus)) {
lastStatus = newStatus;
onlineTextView.setText(newStatus);
}
}
lastPrintString = null;
@ -2936,6 +2928,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
actionBar.showActionMode();
if (Build.VERSION.SDK_INT >= 11) {
AnimatorSetProxy animatorSet = new AnimatorSetProxy();
ArrayList<Object> animators = new ArrayList<Object>();
for (int a = 0; a < actionModeViews.size(); a++) {
@ -2950,6 +2943,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
animatorSet.playTogether(animators);
animatorSet.setDuration(250);
animatorSet.start();
}
addToSelectedMessages(message);
updateActionModeTitle();

View File

@ -12,6 +12,7 @@ import android.content.Context;
import android.os.Bundle;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.Surface;
import android.view.View;
import android.view.ViewGroup;
@ -69,6 +70,13 @@ public class IdenticonActivity extends BaseFragment {
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)));
}
fragmentView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
return true;
}
});
} else {
ViewGroup parent = (ViewGroup)fragmentView.getParent();
if (parent != null) {

View File

@ -654,7 +654,7 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
actionBarLayout.presentFragment(new SettingsActivity(), false, true, true);
drawerLayoutContainer.setAllowOpenDrawer(false);
if (AndroidUtilities.isTablet()) {
layersActionBarLayout.showLastFragment();
actionBarLayout.showLastFragment();
rightActionBarLayout.showLastFragment();
}
pushOpened = true;

View File

@ -1272,12 +1272,13 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
if (!init) {
currentThumb = null;
}
placeProvider.willSwitchFromPhoto(currentMessageObject, currentFileLocation, currentIndex);
int prevIndex = currentIndex;
currentIndex = index;
currentFileNames[0] = getFileName(index);
currentFileNames[1] = getFileName(index + 1);
currentFileNames[2] = getFileName(index - 1);
placeProvider.willSwitchFromPhoto(currentMessageObject, currentFileLocation, currentIndex);
int prevIndex = currentIndex;
currentIndex = index;
boolean sameImage = false;
if (!imagesArr.isEmpty()) {
@ -1975,25 +1976,23 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
if (animationStartTime == 0) {
AndroidUtilities.unlockOrientation(parentActivity);
}
//return false;
return false;
}
if(ev.getPointerCount() == 1 && gestureDetector.onTouchEvent(ev) && doubleTap) {
doubleTap = false;
moving = false;
zooming = false;
if (animationInProgress == 0 && animationStartTime == 0) {
checkMinMax(false);
return true;
}
}
if (ev.getActionMasked() == MotionEvent.ACTION_DOWN || ev.getActionMasked() == MotionEvent.ACTION_POINTER_DOWN) {
if (!scroller.isFinished()) {
scroller.abortAnimation();
}
if (!draggingDown) {
if (canZoom && ev.getPointerCount() == 2 && !changingPage) {
if (!draggingDown && !changingPage) {
if (canZoom && ev.getPointerCount() == 2) {
pinchStartDistance = (float) Math.hypot(ev.getX(1) - ev.getX(0), ev.getY(1) - ev.getY(0));
pinchStartScale = scale;
pinchCenterX = (ev.getX(0) + ev.getX(1)) / 2.0f;
@ -2040,7 +2039,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
} else if (draggingDown) {
translationY = ev.getY() - dragY;
containerView.invalidate();
} else if (!invalidCoords/* && animationStartTime == 0*/) {
} else if (!invalidCoords && animationStartTime == 0) {
float moveDx = moveStartX - ev.getX();
float moveDy = moveStartY - ev.getY();
if (moving || scale == 1 && Math.abs(moveDy) + AndroidUtilities.dp(12) < Math.abs(moveDx) || scale != 1) {

View File

@ -763,7 +763,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
if (id == NotificationCenter.updateInterfaces) {
int mask = (Integer)args[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();
}
} else if (chat_id != 0) {
@ -1042,8 +1042,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
photo = user.photo.photo_small;
photoBig = user.photo.photo_big;
}
AvatarDrawable avatarDrawable = new AvatarDrawable(user, true);
avatarDrawable.setColor(0xff5c98cd);
AvatarDrawable avatarDrawable = new AvatarDrawable(user);
avatarImage.setImage(photo, "50_50", avatarDrawable);
nameTextView.setText(ContactsController.formatName(user.first_name, user.last_name));

View File

@ -69,6 +69,7 @@ public class AvatarDrawable extends Drawable {
}
public AvatarDrawable(TLRPC.User user, boolean profile) {
this();
isProfile = profile;
if (user != null) {
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) {
this();
isProfile = profile;
if (chat != null) {
setInfo(chat.id, chat.title, null, chat.id < 0);

View File

@ -400,6 +400,10 @@ public class Switch extends CompoundButton {
wasLayout = false;
}
public void resetLayout() {
wasLayout = false;
}
@Override
public void setChecked(boolean checked) {
super.setChecked(checked);

View File

@ -12,7 +12,6 @@ import android.content.Context;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Paint;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.text.Layout;
import android.text.StaticLayout;
@ -37,9 +36,9 @@ public class TimerDrawable extends Drawable {
emptyTimerDrawable = context.getResources().getDrawable(R.drawable.header_timer);
timerDrawable = context.getResources().getDrawable(R.drawable.header_timer2);
timePaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
timePaint.setTextSize(AndroidUtilities.dp(10));
timePaint.setColor(0xffd7e8f7);
timePaint.setTypeface(Typeface.DEFAULT_BOLD);
timePaint.setTextSize(AndroidUtilities.dp(11));
timePaint.setColor(0xffffffff);
timePaint.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
}
}
@ -90,8 +89,8 @@ public class TimerDrawable extends Drawable {
@Override
public void draw(Canvas canvas) {
int width = getBounds().width();
int height = getBounds().height();
int width = timerDrawable.getIntrinsicWidth();
int height = timerDrawable.getIntrinsicHeight();
Drawable drawable = null;
if (time == 0) {
drawable = timerDrawable;
@ -105,7 +104,11 @@ public class TimerDrawable extends Drawable {
drawable.draw(canvas);
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);
}
}
@ -127,11 +130,11 @@ public class TimerDrawable extends Drawable {
@Override
public int getIntrinsicWidth() {
return -1;
return timerDrawable.getIntrinsicWidth();
}
@Override
public int getIntrinsicHeight() {
return -1;
return timerDrawable.getIntrinsicHeight();
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 698 B

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 715 B

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB