diff --git a/TMessagesProj/build.gradle b/TMessagesProj/build.gradle index 9f802790..6cd896cc 100644 --- a/TMessagesProj/build.gradle +++ b/TMessagesProj/build.gradle @@ -80,7 +80,7 @@ android { defaultConfig { minSdkVersion 8 targetSdkVersion 21 - versionCode 388 - versionName "2.0.1" + versionCode 391 + versionName "2.0.2" } } diff --git a/TMessagesProj/src/main/java/org/telegram/android/ContactsController.java b/TMessagesProj/src/main/java/org/telegram/android/ContactsController.java index 122469c0..d10ae4e7 100644 --- a/TMessagesProj/src/main/java/org/telegram/android/ContactsController.java +++ b/TMessagesProj/src/main/java/org/telegram/android/ContactsController.java @@ -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(); diff --git a/TMessagesProj/src/main/java/org/telegram/android/MessagesController.java b/TMessagesProj/src/main/java/org/telegram/android/MessagesController.java index 3ecdc587..69f5f2ff 100644 --- a/TMessagesProj/src/main/java/org/telegram/android/MessagesController.java +++ b/TMessagesProj/src/main/java/org/telegram/android/MessagesController.java @@ -68,6 +68,8 @@ public class MessagesController implements NotificationCenter.NotificationCenter private boolean startingSecretChat = false; private ArrayList loadingFullUsers = new ArrayList(); private ArrayList loadedFullUsers = new ArrayList(); + private ArrayList loadingFullChats = new ArrayList(); + private ArrayList loadedFullChats = new ArrayList(); private HashMap> secretHolesQueue = new HashMap>(); @@ -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 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; - } - 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 (fromCache && chat_id > 0) { + loadFullChat(chat_id, 0); + } + if (info != null) { AndroidUtilities.runOnUIThread(new Runnable() { @Override public void run() { diff --git a/TMessagesProj/src/main/java/org/telegram/android/PhotoObject.java b/TMessagesProj/src/main/java/org/telegram/android/PhotoObject.java index fb7ac51c..b489d12f 100644 --- a/TMessagesProj/src/main/java/org/telegram/android/PhotoObject.java +++ b/TMessagesProj/src/main/java/org/telegram/android/PhotoObject.java @@ -18,6 +18,7 @@ import org.telegram.messenger.Utilities; import java.util.ArrayList; public class PhotoObject { + public TLRPC.PhotoSize photoOwner; public Bitmap image; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarLayout.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarLayout.java index f56a9573..224a7b1d 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarLayout.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarLayout.java @@ -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; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMediaCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMediaCell.java index 4ac648c4..17b790a0 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMediaCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMediaCell.java @@ -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; - 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 { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextCheckCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextCheckCell.java index 150c7ef4..5dc3b4ed 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextCheckCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextCheckCell.java @@ -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); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextSettingsCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextSettingsCell.java index a69ebbc2..e6c0414c 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextSettingsCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextSettingsCell.java @@ -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); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java index e60b92f8..e49fb47a 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java @@ -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); + } + 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 public void onAttachButtonShow() { - /*if (runningAnimation2 != null) { - runningAnimation2.cancel(); - runningAnimation2 = null; + if (attachItem != null) { + attachItem.setVisibility(View.INVISIBLE); + } + 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); @@ -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(); + headerItem = menu.addItem(0, R.drawable.ic_ab_other); + if (currentUser != null) { + addContactItem = headerItem.addSubItem(share_contact, "", 0); + } if (currentEncryptedChat != null) { - timeItem = menu.addItem(chat_enc_timer, timerDrawable = new TimerDrawable(getParentActivity())); - //headerItem = timeItem; + 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) { + headerItem.addSubItem(delete_chat, LocaleController.getString("DeleteAndExit", R.string.DeleteAndExit), 0); } else { - ActionBarMenuItem item = menu.addItem(0, R.drawable.ic_ab_other); - 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; + 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,20 +2928,22 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } actionBar.showActionMode(); - AnimatorSetProxy animatorSet = new AnimatorSetProxy(); - ArrayList animators = new ArrayList(); - for (int a = 0; a < actionModeViews.size(); a++) { - View view = actionModeViews.get(a); - AndroidUtilities.clearDrawableAnimation(view); - if (a < 1) { - animators.add(ObjectAnimatorProxy.ofFloat(view, "translationX", -AndroidUtilities.dp(56), 0)); - } else { - animators.add(ObjectAnimatorProxy.ofFloat(view, "scaleY", 0.1f, 1.0f)); + if (Build.VERSION.SDK_INT >= 11) { + AnimatorSetProxy animatorSet = new AnimatorSetProxy(); + ArrayList animators = new ArrayList(); + for (int a = 0; a < actionModeViews.size(); a++) { + View view = actionModeViews.get(a); + AndroidUtilities.clearDrawableAnimation(view); + if (a < 1) { + animators.add(ObjectAnimatorProxy.ofFloat(view, "translationX", -AndroidUtilities.dp(56), 0)); + } 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); updateActionModeTitle(); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/IdenticonActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/IdenticonActivity.java index e236c289..f33daa47 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/IdenticonActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/IdenticonActivity.java @@ -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) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java index 914ef9c6..6364dd49 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java @@ -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; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java b/TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java index 265dad98..c581a3bd 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java @@ -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; - } + 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) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java index 289197cd..6e2cadb6 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java @@ -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)); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Views/AvatarDrawable.java b/TMessagesProj/src/main/java/org/telegram/ui/Views/AvatarDrawable.java index 5a5b7795..d053bd88 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Views/AvatarDrawable.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Views/AvatarDrawable.java @@ -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); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Views/Switch.java b/TMessagesProj/src/main/java/org/telegram/ui/Views/Switch.java index e9da9a3b..b1bb9aa0 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Views/Switch.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Views/Switch.java @@ -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); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Views/TimerDrawable.java b/TMessagesProj/src/main/java/org/telegram/ui/Views/TimerDrawable.java index 1df99ecd..6252ac35 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Views/TimerDrawable.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Views/TimerDrawable.java @@ -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(); } } diff --git a/TMessagesProj/src/main/res/drawable-hdpi/header_timer.png b/TMessagesProj/src/main/res/drawable-hdpi/header_timer.png index d9ad068b..0c17b9bb 100755 Binary files a/TMessagesProj/src/main/res/drawable-hdpi/header_timer.png and b/TMessagesProj/src/main/res/drawable-hdpi/header_timer.png differ diff --git a/TMessagesProj/src/main/res/drawable-hdpi/header_timer2.png b/TMessagesProj/src/main/res/drawable-hdpi/header_timer2.png index ed8261f2..019ad9c9 100755 Binary files a/TMessagesProj/src/main/res/drawable-hdpi/header_timer2.png and b/TMessagesProj/src/main/res/drawable-hdpi/header_timer2.png differ diff --git a/TMessagesProj/src/main/res/drawable-mdpi/header_timer.png b/TMessagesProj/src/main/res/drawable-mdpi/header_timer.png index c20e092c..66aee6c2 100755 Binary files a/TMessagesProj/src/main/res/drawable-mdpi/header_timer.png and b/TMessagesProj/src/main/res/drawable-mdpi/header_timer.png differ diff --git a/TMessagesProj/src/main/res/drawable-mdpi/header_timer2.png b/TMessagesProj/src/main/res/drawable-mdpi/header_timer2.png index d1db0004..5b63eb2a 100755 Binary files a/TMessagesProj/src/main/res/drawable-mdpi/header_timer2.png and b/TMessagesProj/src/main/res/drawable-mdpi/header_timer2.png differ diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/header_timer.png b/TMessagesProj/src/main/res/drawable-xhdpi/header_timer.png index 41d06be9..7bdc8d56 100755 Binary files a/TMessagesProj/src/main/res/drawable-xhdpi/header_timer.png and b/TMessagesProj/src/main/res/drawable-xhdpi/header_timer.png differ diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/header_timer2.png b/TMessagesProj/src/main/res/drawable-xhdpi/header_timer2.png index 02ce1d00..37c985e6 100755 Binary files a/TMessagesProj/src/main/res/drawable-xhdpi/header_timer2.png and b/TMessagesProj/src/main/res/drawable-xhdpi/header_timer2.png differ diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/header_timer.png b/TMessagesProj/src/main/res/drawable-xxhdpi/header_timer.png index 859aa5c7..9d27a863 100755 Binary files a/TMessagesProj/src/main/res/drawable-xxhdpi/header_timer.png and b/TMessagesProj/src/main/res/drawable-xxhdpi/header_timer.png differ diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/header_timer2.png b/TMessagesProj/src/main/res/drawable-xxhdpi/header_timer2.png index 9376a7b9..aeaa2455 100755 Binary files a/TMessagesProj/src/main/res/drawable-xxhdpi/header_timer2.png and b/TMessagesProj/src/main/res/drawable-xxhdpi/header_timer2.png differ