diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java index 2adbf61997..8f46def98d 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java @@ -345,10 +345,12 @@ public void setAlpha(int a) { private boolean callItemVisible; private boolean videoCallItemVisible; private boolean editItemVisible; + private boolean eventLogItemVisible; private ActionBarMenuItem animatingItem; private ActionBarMenuItem callItem; private ActionBarMenuItem videoCallItem; private ActionBarMenuItem editItem; + private ActionBarMenuItem eventLogItem; private ActionBarMenuItem otherItem; private ActionBarMenuItem searchItem; private ImageView ttlIconView; @@ -1340,6 +1342,11 @@ public PagerIndicatorView(Context context) { editItem.setScaleY(1f - value); editItem.setAlpha(1f - value); } + if (eventLogItemVisible) { + eventLogItem.setScaleX(1f - value); + eventLogItem.setScaleY(1f - value); + eventLogItem.setAlpha(1f - value); + } if (callItemVisible) { callItem.setScaleX(1f - value); callItem.setScaleY(1f - value); @@ -1365,6 +1372,9 @@ public void onAnimationEnd(Animator animation) { if (editItemVisible) { editItem.setVisibility(GONE); } + if (eventLogItemVisible) { + eventLogItem.setVisibility(GONE); + } if (callItemVisible) { callItem.setVisibility(GONE); } @@ -1384,6 +1394,9 @@ public void onAnimationStart(Animator animation) { if (editItemVisible) { editItem.setVisibility(VISIBLE); } + if (eventLogItemVisible) { + eventLogItem.setVisibility(VISIBLE); + } if (callItemVisible) { callItem.setVisibility(VISIBLE); } @@ -1520,6 +1533,8 @@ private ActionBarMenuItem getSecondaryMenuItem() { return callItem; } else if (editItemVisible) { return editItem; + } else if (eventLogItemVisible) { + return eventLogItem; } else if (searchItem != null) { return searchItem; } else { @@ -2813,6 +2828,7 @@ protected void onSearchStateChanged(boolean expanded) { callItem.setVisibility(expanded || !callItemVisible ? GONE : INVISIBLE); videoCallItem.setVisibility(expanded || !videoCallItemVisible ? GONE : INVISIBLE); editItem.setVisibility(expanded || !editItemVisible ? GONE : INVISIBLE); + eventLogItem.setVisibility(expanded || !eventLogItemVisible ? GONE : INVISIBLE); otherItem.setVisibility(expanded ? GONE : INVISIBLE); // if (qrItem != null) { // qrItem.setVisibility(expanded ? GONE : INVISIBLE); @@ -2888,6 +2904,8 @@ public void onTextChanged(EditText editText) { callItem = menu.addItem(call_item, R.drawable.ic_call); callItem.setContentDescription(LocaleController.getString("Call", R.string.Call)); } + eventLogItem = menu.addItem(event_log, R.drawable.msg_log); + eventLogItem.setContentDescription(LocaleController.getString("EventLog", R.string.EventLog)); editItem = menu.addItem(edit_channel, R.drawable.group_edit_profile); editItem.setContentDescription(LocaleController.getString("Edit", R.string.Edit)); otherItem = menu.addItem(10, R.drawable.ic_ab_other, resourcesProvider); @@ -5800,6 +5818,7 @@ public void setValue(ActionBar object, float value) { callItem.setIconColor(getThemedColor(Theme.key_actionBarDefaultIcon)); videoCallItem.setIconColor(getThemedColor(Theme.key_actionBarDefaultIcon)); editItem.setIconColor(getThemedColor(Theme.key_actionBarDefaultIcon)); + eventLogItem.setIconColor(getThemedColor(Theme.key_actionBarDefaultIcon)); if (verifiedDrawable != null) { color1 = getThemedColor(Theme.key_profile_verifiedBackground); @@ -5821,7 +5840,7 @@ public void setValue(ActionBar object, float value) { updateEmojiStatusDrawableColor(); - if (avatarsViewPagerIndicatorView.getSecondaryMenuItem() != null && (videoCallItemVisible || editItemVisible || callItemVisible)) { + if (avatarsViewPagerIndicatorView.getSecondaryMenuItem() != null && (videoCallItemVisible || editItemVisible || callItemVisible || eventLogItemVisible)) { needLayoutText(Math.min(1f, extraHeight / AndroidUtilities.dp(88f))); } } @@ -5854,6 +5873,9 @@ private void setMediaHeaderVisible(boolean visible) { if (editItemVisible) { editItem.setVisibility(View.VISIBLE); } + if (eventLogItemVisible) { + eventLogItem.setVisibility(View.VISIBLE); + } otherItem.setVisibility(View.VISIBLE); } else { if (sharedMediaLayout.isSearchItemVisible()) { @@ -5876,10 +5898,12 @@ private void setMediaHeaderVisible(boolean visible) { animators.add(ObjectAnimator.ofFloat(videoCallItem, View.ALPHA, visible ? 0.0f : 1.0f)); animators.add(ObjectAnimator.ofFloat(otherItem, View.ALPHA, visible ? 0.0f : 1.0f)); animators.add(ObjectAnimator.ofFloat(editItem, View.ALPHA, visible ? 0.0f : 1.0f)); + animators.add(ObjectAnimator.ofFloat(eventLogItem, View.ALPHA, visible ? 0.0f : 1.0f)); animators.add(ObjectAnimator.ofFloat(callItem, View.TRANSLATION_Y, visible ? -AndroidUtilities.dp(10) : 0.0f)); animators.add(ObjectAnimator.ofFloat(videoCallItem, View.TRANSLATION_Y, visible ? -AndroidUtilities.dp(10) : 0.0f)); animators.add(ObjectAnimator.ofFloat(otherItem, View.TRANSLATION_Y, visible ? -AndroidUtilities.dp(10) : 0.0f)); animators.add(ObjectAnimator.ofFloat(editItem, View.TRANSLATION_Y, visible ? -AndroidUtilities.dp(10) : 0.0f)); + animators.add(ObjectAnimator.ofFloat(eventLogItem, View.TRANSLATION_Y, visible ? -AndroidUtilities.dp(10) : 0.0f)); animators.add(ObjectAnimator.ofFloat(mediaSearchItem, View.ALPHA, visible ? 1.0f : 0.0f)); animators.add(ObjectAnimator.ofFloat(mediaSearchItem, View.TRANSLATION_Y, visible ? 0.0f : AndroidUtilities.dp(10))); animators.add(ObjectAnimator.ofFloat(sharedMediaLayout.photoVideoOptionsItem, View.ALPHA, visible ? 1.0f : 0.0f)); @@ -5908,6 +5932,9 @@ public void onAnimationEnd(Animator animation) { if (editItemVisible) { editItem.setVisibility(View.GONE); } + if (eventLogItemVisible) { + eventLogItem.setVisibility(View.GONE); + } otherItem.setVisibility(View.GONE); } else { if (sharedMediaLayout.isSearchItemVisible()) { @@ -6472,6 +6499,9 @@ private void needLayoutText(float diff) { int viewWidth = AndroidUtilities.isTablet() ? AndroidUtilities.dp(490) : AndroidUtilities.displaySize.x; ActionBarMenuItem item = avatarsViewPagerIndicatorView.getSecondaryMenuItem(); int extra = 0; + if (eventLogItemVisible) { + extra += 48; + } if (editItemVisible) { extra += 48; } @@ -7200,6 +7230,10 @@ public AnimatorSet onCustomTransitionAnimation(final boolean isOpen, final Runna editItem.setAlpha(0.0f); animators.add(ObjectAnimator.ofFloat(editItem, View.ALPHA, 1.0f)); } + if (eventLogItemVisible) { + eventLogItem.setAlpha(0.0f); + animators.add(ObjectAnimator.ofFloat(eventLogItem, View.ALPHA, 1.0f)); + } if (ttlIconView.getTag() != null) { ttlIconView.setAlpha(0f); animators.add(ObjectAnimator.ofFloat(ttlIconView, View.ALPHA, 1.0f)); @@ -7260,6 +7294,10 @@ public AnimatorSet onCustomTransitionAnimation(final boolean isOpen, final Runna editItem.setAlpha(1.0f); animators.add(ObjectAnimator.ofFloat(editItem, View.ALPHA, 0.0f)); } + if (eventLogItemVisible) { + eventLogItem.setAlpha(1.0f); + animators.add(ObjectAnimator.ofFloat(eventLogItem, View.ALPHA, 0.0f)); + } if (ttlIconView != null) { animators.add(ObjectAnimator.ofFloat(ttlIconView, View.ALPHA, ttlIconView.getAlpha(), 0.0f)); } @@ -8475,6 +8513,7 @@ private void createActionBarMenu(boolean animated) { otherItem.removeAllSubItems(); animatingItem = null; + eventLogItemVisible = false; editItemVisible = false; callItemVisible = false; videoCallItemVisible = false; @@ -8612,6 +8651,7 @@ private void createActionBarMenu(boolean animated) { } if (ChatObject.hasAdminRights(currentChat)) { otherItem.addSubItem(event_log, R.drawable.group_log, LocaleController.getString("EventLog", R.string.EventLog)); + eventLogItemVisible = true; } } else { if (chatInfo != null) { @@ -8703,9 +8743,27 @@ private void createActionBarMenu(boolean animated) { editItem.setVisibility(View.GONE); } } + if (eventLogItemVisible) { + if (eventLogItem.getVisibility() != View.VISIBLE) { + eventLogItem.setVisibility(View.VISIBLE); + if (animated) { + eventLogItem.setAlpha(0); + eventLogItem.animate().alpha(1f).setDuration(150).start(); + } + } + } else { + if (eventLogItem.getVisibility() != View.GONE) { + eventLogItem.setVisibility(View.GONE); + } + } } if (avatarsViewPagerIndicatorView != null) { if (avatarsViewPagerIndicatorView.isIndicatorFullyVisible()) { + if (eventLogItemVisible) { + eventLogItem.setVisibility(View.GONE); + eventLogItem.animate().cancel(); + eventLogItem.setAlpha(1f); + } if (editItemVisible) { editItem.setVisibility(View.GONE); editItem.animate().cancel();