feat: show event log at profile activity

Co-authored-by: Next Alone <12210746+NextAlone@users.noreply.github.com>
This commit is contained in:
xtaodada 2023-05-31 15:10:05 +08:00
parent 5f1f86f355
commit 4969677765
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659

View File

@ -345,10 +345,12 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
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 class ProfileActivity extends BaseFragment implements NotificationCenter.
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 class ProfileActivity extends BaseFragment implements NotificationCenter.
if (editItemVisible) {
editItem.setVisibility(GONE);
}
if (eventLogItemVisible) {
eventLogItem.setVisibility(GONE);
}
if (callItemVisible) {
callItem.setVisibility(GONE);
}
@ -1384,6 +1394,9 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
if (editItemVisible) {
editItem.setVisibility(VISIBLE);
}
if (eventLogItemVisible) {
eventLogItem.setVisibility(VISIBLE);
}
if (callItemVisible) {
callItem.setVisibility(VISIBLE);
}
@ -1520,6 +1533,8 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
return callItem;
} else if (editItemVisible) {
return editItem;
} else if (eventLogItemVisible) {
return eventLogItem;
} else if (searchItem != null) {
return searchItem;
} else {
@ -2813,6 +2828,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
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 class ProfileActivity extends BaseFragment implements NotificationCenter.
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 class ProfileActivity extends BaseFragment implements NotificationCenter.
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 class ProfileActivity extends BaseFragment implements NotificationCenter.
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 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
if (editItemVisible) {
editItem.setVisibility(View.VISIBLE);
}
if (eventLogItemVisible) {
eventLogItem.setVisibility(View.VISIBLE);
}
otherItem.setVisibility(View.VISIBLE);
} else {
if (sharedMediaLayout.isSearchItemVisible()) {
@ -5876,10 +5898,12 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
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 class ProfileActivity extends BaseFragment implements NotificationCenter.
if (editItemVisible) {
editItem.setVisibility(View.GONE);
}
if (eventLogItemVisible) {
eventLogItem.setVisibility(View.GONE);
}
otherItem.setVisibility(View.GONE);
} else {
if (sharedMediaLayout.isSearchItemVisible()) {
@ -6472,6 +6499,9 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
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 class ProfileActivity extends BaseFragment implements NotificationCenter.
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 class ProfileActivity extends BaseFragment implements NotificationCenter.
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 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
otherItem.removeAllSubItems();
animatingItem = null;
eventLogItemVisible = false;
editItemVisible = false;
callItemVisible = false;
videoCallItemVisible = false;
@ -8612,6 +8651,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
}
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 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
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();