From 95de265e1a8f13bc691710818db54059e30fe0ce Mon Sep 17 00:00:00 2001 From: DrKLO Date: Mon, 24 Nov 2014 17:14:40 +0300 Subject: [PATCH] Bug fixes --- TMessagesProj/build.gradle | 4 +- .../android/NotificationsController.java | 8 +- .../org/telegram/ui/ActionBar/ActionBar.java | 20 +++ .../telegram/ui/ActionBar/BaseFragment.java | 1 - .../telegram/ui/Adapters/ContactsAdapter.java | 10 +- .../ui/Cells/TextDetailDocumentsCell.java | 21 +++ .../java/org/telegram/ui/ChatActivity.java | 4 +- .../org/telegram/ui/ContactsActivity.java | 8 + .../telegram/ui/DocumentSelectActivity.java | 156 +++++++++++++++++- .../org/telegram/ui/GroupCreateActivity.java | 3 + .../org/telegram/ui/MessagesActivity.java | 4 + .../java/org/telegram/ui/ProfileActivity.java | 4 +- .../ui/Views/ChatActivityEnterView.java | 1 + .../java/org/telegram/ui/Views/CheckBox.java | 25 ++- .../java/org/telegram/ui/Views/Switch.java | 3 +- .../res/drawable-hdpi/ic_ab_done_gray.png | Bin 0 -> 1175 bytes .../res/drawable-mdpi/ic_ab_done_gray.png | Bin 0 -> 1078 bytes .../res/drawable-xhdpi/ic_ab_done_gray.png | Bin 0 -> 1233 bytes .../res/drawable-xxhdpi/ic_ab_done_gray.png | Bin 0 -> 1393 bytes 19 files changed, 251 insertions(+), 21 deletions(-) create mode 100755 TMessagesProj/src/main/res/drawable-hdpi/ic_ab_done_gray.png create mode 100755 TMessagesProj/src/main/res/drawable-mdpi/ic_ab_done_gray.png create mode 100755 TMessagesProj/src/main/res/drawable-xhdpi/ic_ab_done_gray.png create mode 100755 TMessagesProj/src/main/res/drawable-xxhdpi/ic_ab_done_gray.png diff --git a/TMessagesProj/build.gradle b/TMessagesProj/build.gradle index 2a1bb4c7..1f144ec1 100644 --- a/TMessagesProj/build.gradle +++ b/TMessagesProj/build.gradle @@ -80,7 +80,7 @@ android { defaultConfig { minSdkVersion 8 targetSdkVersion 21 - versionCode 395 - versionName "2.0.4" + versionCode 397 + versionName "2.0.5" } } diff --git a/TMessagesProj/src/main/java/org/telegram/android/NotificationsController.java b/TMessagesProj/src/main/java/org/telegram/android/NotificationsController.java index 4b23d7ef..4d4840a6 100644 --- a/TMessagesProj/src/main/java/org/telegram/android/NotificationsController.java +++ b/TMessagesProj/src/main/java/org/telegram/android/NotificationsController.java @@ -425,7 +425,9 @@ public class NotificationsController { } mBuilder.setCategory(NotificationCompat.CATEGORY_MESSAGE); - mBuilder.setVisibility(NotificationCompat.VISIBILITY_PUBLIC); + if (chat == null && user != null && user.phone != null && user.phone.length() > 0) { + mBuilder.addPerson("tel:+" + user.phone); + } /*Bundle bundle = new Bundle(); bundle.putString(NotificationCompat.EXTRA_PEOPLE, ); mBuilder.setExtras()*/ @@ -636,6 +638,10 @@ public class NotificationsController { .extend(new NotificationCompat.WearableExtender().addAction(action)) .setCategory(NotificationCompat.CATEGORY_MESSAGE); + if (chat == null && user != null && user.phone != null && user.phone.length() > 0) { + builder.addPerson("tel:+" + user.phone); + } + notificationManager.notify(notificationId, builder.build()); wearNoticationsIds.put(dialog_id, notificationId); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBar.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBar.java index 4ae92f59..629942b4 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBar.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBar.java @@ -40,6 +40,7 @@ public class ActionBar extends FrameLayout { private ImageView backButtonImageView; private TextView titleTextView; private TextView subTitleTextView; + private View actionModeTop; private ActionBarMenu menu; private ActionBarMenu actionMode; private boolean occupyStatusBar = Build.VERSION.SDK_INT >= 21; @@ -343,6 +344,19 @@ public class ActionBar extends FrameLayout { layoutParams.gravity = Gravity.RIGHT; actionMode.setLayoutParams(layoutParams); actionMode.setVisibility(GONE); + + if (occupyStatusBar) { + actionModeTop = new View(getContext()); + actionModeTop.setBackgroundColor(0x99000000); + addView(actionModeTop); + layoutParams = (FrameLayout.LayoutParams)actionModeTop.getLayoutParams(); + layoutParams.height = AndroidUtilities.statusBarHeight; + layoutParams.width = LayoutParams.FILL_PARENT; + layoutParams.gravity = Gravity.TOP | Gravity.LEFT; + actionModeTop.setLayoutParams(layoutParams); + actionModeTop.setVisibility(GONE); + } + return actionMode; } @@ -351,6 +365,9 @@ public class ActionBar extends FrameLayout { return; } actionMode.setVisibility(VISIBLE); + if (actionModeTop != null) { + actionModeTop.setVisibility(VISIBLE); + } if (titleFrameLayout != null) { titleFrameLayout.setVisibility(INVISIBLE); } @@ -364,6 +381,9 @@ public class ActionBar extends FrameLayout { return; } actionMode.setVisibility(GONE); + if (actionModeTop != null) { + actionModeTop.setVisibility(GONE); + } if (titleFrameLayout != null) { titleFrameLayout.setVisibility(VISIBLE); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BaseFragment.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BaseFragment.java index 8646005b..9270ca1c 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BaseFragment.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BaseFragment.java @@ -119,7 +119,6 @@ public class BaseFragment { public void onPause() { if (actionBar != null) { actionBar.onPause(); - actionBar.closeSearchField(); } try { if (visibleDialog != null && visibleDialog.isShowing()) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Adapters/ContactsAdapter.java b/TMessagesProj/src/main/java/org/telegram/ui/Adapters/ContactsAdapter.java index 99915e3e..cd50fac4 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Adapters/ContactsAdapter.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Adapters/ContactsAdapter.java @@ -9,6 +9,7 @@ package org.telegram.ui.Adapters; import android.content.Context; +import android.os.Build; import android.view.View; import android.view.ViewGroup; @@ -35,6 +36,7 @@ public class ContactsAdapter extends BaseSectionsAdapter { private boolean needPhonebook; private HashMap ignoreUsers; private HashMap checkedMap; + private boolean scrolling; public ContactsAdapter(Context context, boolean arg1, boolean arg2, HashMap arg3) { mContext = context; @@ -47,6 +49,10 @@ public class ContactsAdapter extends BaseSectionsAdapter { checkedMap = map; } + public void setIsScrolling(boolean value) { + scrolling = value; + } + @Override public Object getItem(int section, int position) { if (onlyUsers) { @@ -175,7 +181,7 @@ public class ContactsAdapter extends BaseSectionsAdapter { if (type == 4) { if (convertView == null) { convertView = new DividerCell(mContext); - convertView.setPadding(AndroidUtilities.dp(LocaleController.isRTL ? 24 : 72), 0, AndroidUtilities.dp(LocaleController.isRTL ? 72 : 24), 0); + convertView.setPadding(AndroidUtilities.dp(LocaleController.isRTL ? 28 : 72), 0, AndroidUtilities.dp(LocaleController.isRTL ? 72 : 28), 0); } } else if (type == 3) { if (convertView == null) { @@ -220,7 +226,7 @@ public class ContactsAdapter extends BaseSectionsAdapter { TLRPC.User user = MessagesController.getInstance().getUser(arr.get(position).user_id); ((UserCell)convertView).setData(user, null, null, 0); if (checkedMap != null) { - ((UserCell) convertView).setChecked(checkedMap.containsKey(user.id), false); + ((UserCell) convertView).setChecked(checkedMap.containsKey(user.id), !scrolling && Build.VERSION.SDK_INT > 10); } if (ignoreUsers != null) { if (ignoreUsers.containsKey(user.id)) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextDetailDocumentsCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextDetailDocumentsCell.java index 46bcf793..43700151 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextDetailDocumentsCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextDetailDocumentsCell.java @@ -19,6 +19,7 @@ import android.widget.TextView; import org.telegram.android.AndroidUtilities; import org.telegram.android.LocaleController; import org.telegram.ui.Views.BackupImageView; +import org.telegram.ui.Views.CheckBox; public class TextDetailDocumentsCell extends FrameLayout { @@ -26,6 +27,7 @@ public class TextDetailDocumentsCell extends FrameLayout { private TextView valueTextView; private TextView typeTextView; private BackupImageView imageView; + private CheckBox checkBox; public TextDetailDocumentsCell(Context context) { super(context); @@ -90,6 +92,18 @@ public class TextDetailDocumentsCell extends FrameLayout { layoutParams.rightMargin = AndroidUtilities.dp(LocaleController.isRTL ? 16 : 0); layoutParams.gravity = (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL; imageView.setLayoutParams(layoutParams); + + checkBox = new CheckBox(context); + checkBox.setVisibility(GONE); + addView(checkBox); + layoutParams = (LayoutParams) checkBox.getLayoutParams(); + layoutParams.width = AndroidUtilities.dp(22); + layoutParams.height = AndroidUtilities.dp(22); + layoutParams.topMargin = AndroidUtilities.dp(34); + layoutParams.leftMargin = LocaleController.isRTL ? 0 : AndroidUtilities.dp(38); + layoutParams.rightMargin = LocaleController.isRTL ? AndroidUtilities.dp(38) : 0; + layoutParams.gravity = (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT); + checkBox.setLayoutParams(layoutParams); } @Override @@ -117,4 +131,11 @@ public class TextDetailDocumentsCell extends FrameLayout { imageView.setVisibility(GONE); } } + + public void setChecked(boolean checked, boolean animated) { + if (checkBox.getVisibility() != VISIBLE) { + checkBox.setVisibility(VISIBLE); + } + checkBox.setChecked(checked, animated); + } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java index 3777d6ba..a8880bab 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java @@ -572,9 +572,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not DocumentSelectActivity fragment = new DocumentSelectActivity(); fragment.setDelegate(new DocumentSelectActivity.DocumentSelectActivityDelegate() { @Override - public void didSelectFile(DocumentSelectActivity activity, String path) { + public void didSelectFiles(DocumentSelectActivity activity, ArrayList files) { activity.finishFragment(); - SendMessagesHelper.prepareSendingDocument(path, path, null, null, dialog_id); + SendMessagesHelper.prepareSendingDocuments(files, files, null, null, dialog_id); } @Override diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ContactsActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ContactsActivity.java index deba9e8f..a2b44f87 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ContactsActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ContactsActivity.java @@ -440,6 +440,14 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter } } + @Override + public void onPause() { + super.onPause(); + if (actionBar != null) { + actionBar.closeSearchField(); + } + } + @Override public void didReceivedNotification(int id, Object... args) { if (id == NotificationCenter.contactsDidLoaded) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/DocumentSelectActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/DocumentSelectActivity.java index d56a7be6..66b99d28 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/DocumentSelectActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/DocumentSelectActivity.java @@ -16,11 +16,15 @@ import android.content.IntentFilter; import android.os.Build; import android.os.Environment; import android.os.StatFs; +import android.text.TextUtils; +import android.view.Gravity; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; +import android.widget.AbsListView; import android.widget.AdapterView; +import android.widget.LinearLayout; import android.widget.ListView; import android.widget.TextView; @@ -33,6 +37,8 @@ import org.telegram.ui.Adapters.BaseFragmentAdapter; import org.telegram.ui.ActionBar.ActionBar; import org.telegram.ui.ActionBar.ActionBarMenu; import org.telegram.ui.ActionBar.ActionBarMenuItem; +import org.telegram.ui.AnimationCompat.AnimatorSetProxy; +import org.telegram.ui.AnimationCompat.ObjectAnimatorProxy; import org.telegram.ui.Cells.TextDetailDocumentsCell; import org.telegram.ui.ActionBar.BaseFragment; @@ -47,19 +53,26 @@ import java.util.HashMap; public class DocumentSelectActivity extends BaseFragment { public static abstract interface DocumentSelectActivityDelegate { - public void didSelectFile(DocumentSelectActivity activity, String path); + public void didSelectFiles(DocumentSelectActivity activity, ArrayList files); public void startDocumentSelectActivity(); } private ListView listView; private ListAdapter listAdapter; - private File currentDir; + private TextView selectedMessagesCountTextView; private TextView emptyView; + + private File currentDir; private ArrayList items = new ArrayList(); private boolean receiverRegistered = false; private ArrayList history = new ArrayList(); private long sizeLimit = 1024 * 1024 * 1024; private DocumentSelectActivityDelegate delegate; + private HashMap selectedFiles = new HashMap(); + private ArrayList actionModeViews = new ArrayList(); + private boolean scrolling; + + private final static int done = 3; private class ListItem { int icon; @@ -144,11 +157,51 @@ public class DocumentSelectActivity extends BaseFragment { delegate.startDocumentSelectActivity(); } finishFragment(false); + } else if (id == -2) { + selectedFiles.clear(); + actionBar.hideActionMode(); + listView.invalidateViews(); + } else if (id == done) { + if (delegate != null) { + ArrayList files = new ArrayList(); + files.addAll(selectedFiles.keySet()); + delegate.didSelectFiles(DocumentSelectActivity.this, files); + } } } }); ActionBarMenu menu = actionBar.createMenu(); - ActionBarMenuItem item = menu.addItem(1, R.drawable.ic_ab_other); + final ActionBarMenuItem item = menu.addItem(1, R.drawable.ic_ab_other); + + selectedFiles.clear(); + actionModeViews.clear(); + + final ActionBarMenu actionMode = actionBar.createActionMode(); + actionModeViews.add(actionMode.addItem(-2, R.drawable.ic_ab_back_grey, R.drawable.bar_selector_mode, null, AndroidUtilities.dp(54))); + + selectedMessagesCountTextView = new TextView(actionMode.getContext()); + selectedMessagesCountTextView.setTextSize(18); + selectedMessagesCountTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); + selectedMessagesCountTextView.setTextColor(0xff737373); + selectedMessagesCountTextView.setSingleLine(true); + selectedMessagesCountTextView.setLines(1); + selectedMessagesCountTextView.setEllipsize(TextUtils.TruncateAt.END); + selectedMessagesCountTextView.setPadding(AndroidUtilities.dp(11), 0, 0, AndroidUtilities.dp(2)); + selectedMessagesCountTextView.setGravity(Gravity.CENTER_VERTICAL); + selectedMessagesCountTextView.setOnTouchListener(new View.OnTouchListener() { + @Override + public boolean onTouch(View v, MotionEvent event) { + return true; + } + }); + actionMode.addView(selectedMessagesCountTextView); + LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams)selectedMessagesCountTextView.getLayoutParams(); + layoutParams.weight = 1; + layoutParams.width = 0; + layoutParams.height = LinearLayout.LayoutParams.MATCH_PARENT; + selectedMessagesCountTextView.setLayoutParams(layoutParams); + + actionModeViews.add(actionMode.addItem(done, R.drawable.ic_ab_done_gray, R.drawable.bar_selector_mode, null, AndroidUtilities.dp(54))); fragmentView = inflater.inflate(R.layout.document_select_layout, container, false); listAdapter = new ListAdapter(getParentActivity()); @@ -162,9 +215,75 @@ public class DocumentSelectActivity extends BaseFragment { listView = (ListView)fragmentView.findViewById(R.id.listView); listView.setEmptyView(emptyView); listView.setAdapter(listAdapter); + + listView.setOnScrollListener(new AbsListView.OnScrollListener() { + @Override + public void onScrollStateChanged(AbsListView view, int scrollState) { + scrolling = scrollState != SCROLL_STATE_IDLE; + } + + @Override + public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { + + } + }); + + listView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { + @Override + public boolean onItemLongClick(AdapterView parent, View view, int i, long id) { + if (actionBar.isActionModeShowed() || i < 0 || i >= items.size()) { + return false; + } + ListItem item = items.get(i); + File file = item.file; + if (file != null && !file.isDirectory()) { + if (!file.canRead()) { + showErrorBox(LocaleController.getString("AccessError", R.string.AccessError)); + return false; + } + if (sizeLimit != 0) { + if (file.length() > sizeLimit) { + showErrorBox(LocaleController.formatString("FileUploadLimit", R.string.FileUploadLimit, Utilities.formatFileSize(sizeLimit))); + return false; + } + } + if (file.length() == 0) { + return false; + } + selectedFiles.put(file.toString(), item); + selectedMessagesCountTextView.setText(String.format("%d", selectedFiles.size())); + if (Build.VERSION.SDK_INT >= 11) { + AnimatorSetProxy animatorSet = new AnimatorSetProxy(); + ArrayList animators = new ArrayList(); + for (int a = 0; a < actionModeViews.size(); a++) { + View view2 = actionModeViews.get(a); + AndroidUtilities.clearDrawableAnimation(view2); + if (a < 1) { + animators.add(ObjectAnimatorProxy.ofFloat(view2, "translationX", -AndroidUtilities.dp(56), 0)); + } else { + animators.add(ObjectAnimatorProxy.ofFloat(view2, "scaleY", 0.1f, 1.0f)); + } + } + animatorSet.playTogether(animators); + animatorSet.setDuration(250); + animatorSet.start(); + } + scrolling = false; + if (view instanceof TextDetailDocumentsCell) { + ((TextDetailDocumentsCell) view).setChecked(true, true); + } + actionBar.showActionMode(); + } + return true; + } + }); + listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView adapterView, View view, int i, long l) { + if (i < 0 || i >= items.size()) { + return; + } ListItem item = items.get(i); File file = item.file; if (file == null) { @@ -202,8 +321,27 @@ public class DocumentSelectActivity extends BaseFragment { if (file.length() == 0) { return; } - if (delegate != null) { - delegate.didSelectFile(DocumentSelectActivity.this, file.getAbsolutePath()); + if (actionBar.isActionModeShowed()) { + if (selectedFiles.containsKey(file.toString())) { + selectedFiles.remove(file.toString()); + } else { + selectedFiles.put(file.toString(), item); + } + if (selectedFiles.isEmpty()) { + actionBar.hideActionMode(); + } else { + selectedMessagesCountTextView.setText(String.format("%d", selectedFiles.size())); + } + scrolling = false; + if (view instanceof TextDetailDocumentsCell) { + ((TextDetailDocumentsCell) view).setChecked(selectedFiles.containsKey(item.file.toString()), true); + } + } else { + if (delegate != null) { + ArrayList files = new ArrayList(); + files.add(file.getAbsolutePath()); + delegate.didSelectFiles(DocumentSelectActivity.this, files); + } } } } @@ -263,6 +401,7 @@ public class DocumentSelectActivity extends BaseFragment { emptyView.setText(LocaleController.getString("NotMounted", R.string.NotMounted)); } AndroidUtilities.clearDrawableAnimation(listView); + scrolling = true; listAdapter.notifyDataSetChanged(); return true; } @@ -331,6 +470,7 @@ public class DocumentSelectActivity extends BaseFragment { item.file = null; items.add(0, item); AndroidUtilities.clearDrawableAnimation(listView); + scrolling = true; listAdapter.notifyDataSetChanged(); return true; } @@ -421,6 +561,7 @@ public class DocumentSelectActivity extends BaseFragment { } AndroidUtilities.clearDrawableAnimation(listView); + scrolling = true; listAdapter.notifyDataSetChanged(); } @@ -477,6 +618,11 @@ public class DocumentSelectActivity extends BaseFragment { String type = item.ext.toUpperCase().substring(0, Math.min(item.ext.length(), 4)); ((TextDetailDocumentsCell) convertView).setTextAndValueAndTypeAndThumb(item.title, item.subtitle, type, item.thumb, 0); } + if (item.file != null && actionBar.isActionModeShowed()) { + textDetailCell.setChecked(selectedFiles.containsKey(item.file.toString()), !scrolling); + } else { + textDetailCell.setChecked(false, !scrolling); + } return convertView; } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/GroupCreateActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/GroupCreateActivity.java index 7a319383..18ec6a7e 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/GroupCreateActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/GroupCreateActivity.java @@ -455,6 +455,9 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen if (i == SCROLL_STATE_TOUCH_SCROLL) { AndroidUtilities.hideKeyboard(userSelectEditText); } + if (listViewAdapter != null) { + listViewAdapter.setIsScrolling(i != SCROLL_STATE_IDLE); + } } @Override diff --git a/TMessagesProj/src/main/java/org/telegram/ui/MessagesActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/MessagesActivity.java index fd10cf9d..b244c4e0 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/MessagesActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/MessagesActivity.java @@ -362,6 +362,10 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter } if (message_id != 0) { args.putInt("message_id", message_id); + } else { + if (actionBar != null) { + actionBar.closeSearchField(); + } } if (AndroidUtilities.isTablet()) { if (openedDialogId == dialog_id) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java index 634d6052..14ad761c 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java @@ -485,10 +485,10 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. } else if (i == 1) { if(Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB) { android.text.ClipboardManager clipboard = (android.text.ClipboardManager)ApplicationLoader.applicationContext.getSystemService(Context.CLIPBOARD_SERVICE); - clipboard.setText(user.phone); + clipboard.setText("+" + user.phone); } else { android.content.ClipboardManager clipboard = (android.content.ClipboardManager)ApplicationLoader.applicationContext.getSystemService(Context.CLIPBOARD_SERVICE); - android.content.ClipData clip = android.content.ClipData.newPlainText("label", user.phone); + android.content.ClipData clip = android.content.ClipData.newPlainText("label", "+" + user.phone); clipboard.setPrimaryClip(clip); } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Views/ChatActivityEnterView.java b/TMessagesProj/src/main/java/org/telegram/ui/Views/ChatActivityEnterView.java index ab697708..10643559 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Views/ChatActivityEnterView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Views/ChatActivityEnterView.java @@ -148,6 +148,7 @@ public class ChatActivityEnterView implements NotificationCenter.NotificationCen ViewProxy.setScaleX(sendButton, 0.1f); ViewProxy.setScaleY(sendButton, 0.1f); ViewProxy.setAlpha(sendButton, 0.0f); + sendButton.clearAnimation(); emojiButton = (ImageView) containerView.findViewById(R.id.chat_smile_button); audioSendButton = (ImageButton) containerView.findViewById(R.id.chat_audio_send_button); recordPanel = containerView.findViewById(R.id.record_panel); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Views/CheckBox.java b/TMessagesProj/src/main/java/org/telegram/ui/Views/CheckBox.java index 9a27adba..6f5275b2 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Views/CheckBox.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Views/CheckBox.java @@ -58,13 +58,23 @@ public class CheckBox extends View { eraser2.setStrokeWidth(AndroidUtilities.dp(28)); eraser2.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR)); } - drawBitmap = Bitmap.createBitmap(AndroidUtilities.dp(22), AndroidUtilities.dp(22), Bitmap.Config.ARGB_4444); - bitmapCanvas = new Canvas(drawBitmap); - checkBitmap = Bitmap.createBitmap(AndroidUtilities.dp(22), AndroidUtilities.dp(22), Bitmap.Config.ARGB_4444); - checkCanvas = new Canvas(checkBitmap); + } + + @Override + public void setVisibility(int visibility) { + super.setVisibility(visibility); + if (visibility == VISIBLE && drawBitmap == null) { + drawBitmap = Bitmap.createBitmap(AndroidUtilities.dp(22), AndroidUtilities.dp(22), Bitmap.Config.ARGB_4444); + bitmapCanvas = new Canvas(drawBitmap); + checkBitmap = Bitmap.createBitmap(AndroidUtilities.dp(22), AndroidUtilities.dp(22), Bitmap.Config.ARGB_4444); + checkCanvas = new Canvas(checkBitmap); + } } public void setProgress(float value) { + if (progress == value) { + return; + } progress = value; invalidate(); } @@ -104,8 +114,10 @@ public class CheckBox extends View { } public void setChecked(boolean checked, boolean animated) { + if (checked == isChecked) { + return; + } isChecked = checked; - invalidate(); if (attachedToWindow && animated) { animateToCheckedState(checked); @@ -121,6 +133,9 @@ public class CheckBox extends View { @Override protected void onDraw(Canvas canvas) { + if (getVisibility() != VISIBLE) { + return; + } if (progress != 0) { drawBitmap.eraseColor(0); float rad = getMeasuredWidth() / 2; 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 1a10e433..02e2a537 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Views/Switch.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Views/Switch.java @@ -23,6 +23,7 @@ import android.graphics.PorterDuffColorFilter; import android.graphics.Rect; import android.graphics.Region; import android.graphics.drawable.Drawable; +import android.os.Build; import android.view.Gravity; import android.view.MotionEvent; import android.view.VelocityTracker; @@ -532,7 +533,7 @@ public class Switch extends CompoundButton { mThumbDrawable.setBounds(thumbLeft, switchTop + offset, thumbRight, switchBottom + offset); final Drawable background = getBackground(); - if (background != null) { + if (background != null && Build.VERSION.SDK_INT >= 21) { background.setHotspotBounds(thumbLeft, switchTop, thumbRight, switchBottom); } } diff --git a/TMessagesProj/src/main/res/drawable-hdpi/ic_ab_done_gray.png b/TMessagesProj/src/main/res/drawable-hdpi/ic_ab_done_gray.png new file mode 100755 index 0000000000000000000000000000000000000000..99240881de729f0149fd9ffd73b92c84546862c8 GIT binary patch literal 1175 zcmeAS@N?(olHy`uVBq!ia0vp^Dj>|k1|%Oc%$NbBBuiW)N`mv#O3D+9QW+dm@{>{( zJaZG%Q-e|yQz{EjrrIztFe_z-M3hAM`dB6B=jtVb)aX^@765fKFxc2v6eK2Rr0UTq__OB&@Hb09I0xZL0)vRD^GUf^&XRs)DJWv2L<~p`n7AnVzAE zshOFfj)IYap^?4;5Si&3npl~dSs9rtK!Fm_wxX0Ys~{IQs9ivwtx`rwNr9EVetCJh zUb(Seeo?xx^|#0uTKVr7^KE~&-IMVSR9nfZANAQKal@=Hr> zm4GgVcpgi&u1T;Y}Gc(1?($&bx$<5r!%)-Uk(9qSy(a^=o#oXA<(9PJ< z+|bz(rq?AuximL5uLPzy1)2aRR8b7E-W5?{(zoJ-yNs$iOLls>mP>fS2I=gjn?>}(OG*^ zyn^}3bg?)N#bliq!MsiLrm|N~U=O^$;U(`PjZJ$~nq($g=U*}@-Q^@RS=n5rY;UUl z8LuzmDG#|+k}FhCoM!cCFWi(GCXqG4v`r|4+nIG$??MLCLlWwyY9IL8jf)PM{4Hs` zxK6;JT1M^!%@C+>kDpPbrV3PlSYjkI4u-Yv zyaoF5J!vIBqC`}x<2c#w@K`_xNG2V9)UbI+ptf{*Ja@Ngirj*r5rNuHDkJrhacBWD z><{`BhGj{P^RuBa$FVJBfMEkPgI~_ahWIeY2U^LUhr-b;HOr^OuANwTB~Zf%nLJJB zayfr4=!e!2%|;>-S0fPcVT8|~Fp%u{47;hIAOc&lG!tpiAYDay5RM~(!kKO#K{t10 z4ST0dxL~v+n>6cZ+#?l$lJtM5uJ594lmdJC{!`daPndvC0UM563T|As$qi-laSO-@ zT4@MJ3svkLh6vij&?Mu19C@@~GgO$fo44?i#3v0K$%X=wqCjBjo@;ns*43vj^#SA@#A4h&S_s(ai-QLbwR-NcbaU}y=yM=B2W$o8@d?oHC#m=GJN>A~3>cfNW;D@V@d^GmCq z*i4^V!p>aROYYB16ID06YL;F|QR!H7xbfD3(y6w}+4)lM#f5j~{;J7_Q`4cCH&Ys7 zu2rveP98cl=6%!hGrCbb`#HMyifz1Io@tTEm*$h2h11K?%b&`8(FYf%8dv5X3_M(} dU#}s`>WH`f16QlpYt!ycP9}Q9d$ED@e*oqvS@Zw^ literal 0 HcmV?d00001 diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/ic_ab_done_gray.png b/TMessagesProj/src/main/res/drawable-xhdpi/ic_ab_done_gray.png new file mode 100755 index 0000000000000000000000000000000000000000..41671b4fb933df410d6982c74e5567ae5d13d17f GIT binary patch literal 1233 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA1|-9oezpTC$r9IylHmNblJdl&R0hYC{G?O` z&)mfH)S%SFl*+=BsWuD@%u1Od5hW46K32*3xq68pHF_1f1wh>l3^w)^1&PVosU-?Y zsp*+{wo31J?^jaDOtDo8H}y5}EpSfF$n>ZxN)4{^3rViZPPR-@vbR&PsjvbXkegbP zs8ErclUHn2VXFi-*9yo63F|81#=KlDb#X~hD#E>34K5C;EJ)Q4 zN-fSWElLJPT$(b-ssbzLqSVBa{GyQj{2W*)24v)y2=9ZF3nBND}m`vLFjeHsTY(KatnYqyQCInmZhe+73JqDfW2&$iQ6rfIL(9V zO~LIJN1S@~fsWA!MJ!T8!-RmT2gHOYTObFX@Kf`Esl5o8tdA5#7cnp}x_Y`ehE&{o zGt--|$w0uNamEfo+rIy6)sxn4xX7#ik*Uf2gU7l853fUq`2JqZoIEq-(kjOLr!SNV zU0U~g(hOy9C4R94Mlfnzk(^lFyhvlsy7jN4%I*vEr2qIU7|Y7?hx-%XXCtjf!9QL# zrH55E9eDUS@(4!_>uZHKTr&=_D>8g=5B?#*QuX7Q$h@cnQuBfiaN105Fs|TYT+QmO zYjEKCx(8EdS>AYNW?-YZ{)7Ac2@lk@6&^&N@U}nne64rIiA&qoNHXmg`M_MF|M}XK z8KQEc4VUVU<{9>FZ99^f_v56yht2${E=lH$_s{UI-@>gZwASU2^qx;c-mj#PnPRIHZt82`Ti~3Uk?B!Ylp0*+7m{3+ootz+WN)WnQ(*-(AUCxn zQK2F?C$HG5!d3}vt`(3C64qBz04piUwpD^SD#ABF!8yMuRl!uxSU1_g&``n5OwZ87 z)XdCKN5ROz&`93^h|F{iO{`4Ktc=VRpg;*|TTx1yRgjAt)Gi>;Rw<*Tq`*pFzr4I$ zuiRKKzbIYb(9+TpWQLKEE>MMTab;dfVufyAu`f(~1RD^r68eAMwS&*t9 zlvv ztM~P_^2{qPNz6-5^>ndS0-B(gnVDkcY~pP0YHVR@X5nINXy|I<=NWNK(; zv4~Pj*wm=R%;iu*SQ+p9GS;yX8E6KpX_|((IF{I+w zn>&GiEd~N?2?}<<*F`qEChuuw|G+n|>3i(`j~w$-zcN*G^gm!N@Ho}YSRQ4yCHSAG zn#zWoQ}Ww0Pal3(dq2J7r-lQA0s|w50|S#l149b~kYEAwHP-Hk`o)@in{997y4O1% z?^$;K--4!Pg=Hlcmp^hW$eiPUs`^y3ZqP=>IfiQ{bhQ+|Q!7|A5lH(PTikx<=rhNB z*2Qh%j{6GttZ7zyW7(@eCq>JHOPy1}bB;)ZOW_vgsh2EfHF_CGcRtEsjpB7zzOc&T z)-}iE^EcPGE?(Kx^dN(gt8Fo(hDKj8|Dvm}H%R_jP_y)pm{fGCRFQ$qaxSGg?4MWL z&6d`1ei$IP)O*KrhQb#K7EGcmWT z9adTJR{F|lD`d63PivUTaH%8scuVr#<}*D99ajY%D4cb4hKIUZ&=rew+^+r}rEe^{ z!!B{ln~Pd>ZzDW%RTP>Cy# zsk#&L(1T&8f@`-jYf7_-X`hM!yJnS4=7RqdLLRJPG-+MJcKo}^`ADXeSp{t;J|1U! rC~pV~e-3yguqd!JFg!7?W0hc7WxcL9WYgW%phD2o)z4*}Q$iB}wXNw? literal 0 HcmV?d00001