Remove account avatar from stories header (use bottom menu for account switch)
This commit is contained in:
parent
24676bba9d
commit
1a7c4d72f3
2 changed files with 179 additions and 48 deletions
|
|
@ -602,6 +602,8 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||||
private ChatActivityEnterView commentView;
|
private ChatActivityEnterView commentView;
|
||||||
private ChatActivityEnterView.SendButton writeButton;
|
private ChatActivityEnterView.SendButton writeButton;
|
||||||
private ActionBarMenuItem switchItem;
|
private ActionBarMenuItem switchItem;
|
||||||
|
private FrameLayout mainTabsAvatarButton;
|
||||||
|
private BackupImageView mainTabsAvatarImage;
|
||||||
|
|
||||||
private RectF rect = new RectF();
|
private RectF rect = new RectF();
|
||||||
private Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
private Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||||
|
|
@ -1611,8 +1613,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||||
float pHalf = Utilities.clamp(p / 0.5f, 1f, 0f);
|
float pHalf = Utilities.clamp(p / 0.5f, 1f, 0f);
|
||||||
dialogStoriesCell.setClipTop(0);
|
dialogStoriesCell.setClipTop(0);
|
||||||
if (!hasStories && animateToHasStories) {
|
if (!hasStories && animateToHasStories) {
|
||||||
dialogStoriesCell.setTranslationY(-dp(DialogStoriesCell.HEIGHT_IN_DP) - dp(8));
|
dialogStoriesCell.setTranslationY(-dp(DialogStoriesCell.HEIGHT_IN_DP) - dp(8)); dialogStoriesCell.setProgressToCollapse(1f);
|
||||||
dialogStoriesCell.setProgressToCollapse(1f);
|
|
||||||
containersAlpha = 1f - progressToDialogStoriesCell;
|
containersAlpha = 1f - progressToDialogStoriesCell;
|
||||||
} else {
|
} else {
|
||||||
dialogStoriesCell.setTranslationY(Math.max(scrollYOffset, -getMaxScrollYOffsetWithoutSearch()) + storiesYOffset + storiesOverscroll / 2f - dp(8));
|
dialogStoriesCell.setTranslationY(Math.max(scrollYOffset, -getMaxScrollYOffsetWithoutSearch()) + storiesYOffset + storiesOverscroll / 2f - dp(8));
|
||||||
|
|
@ -1666,6 +1667,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||||
actionBar.getAdditionalSubTitleOverlayContainer().setAlpha(titleAlpha);
|
actionBar.getAdditionalSubTitleOverlayContainer().setAlpha(titleAlpha);
|
||||||
actionBar.getAdditionalSubTitleOverlayContainer().setVisibility(titleAlpha > 0 ? View.VISIBLE : View.INVISIBLE);
|
actionBar.getAdditionalSubTitleOverlayContainer().setVisibility(titleAlpha > 0 ? View.VISIBLE : View.INVISIBLE);
|
||||||
}
|
}
|
||||||
|
updateMainTabsAvatarPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static float viewOffset = 0.0f;
|
public static float viewOffset = 0.0f;
|
||||||
|
|
@ -2942,8 +2944,8 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||||
}
|
}
|
||||||
|
|
||||||
BirthdayController.getInstance(currentAccount).check();
|
BirthdayController.getInstance(currentAccount).check();
|
||||||
additionNavigationBarHeight = hasMainTabs && !NekoConfig.hideBottomNavigationBar ? dp(MAIN_TABS_HEIGHT_WITH_MARGINS) : 0;
|
additionNavigationBarHeight = hasMainTabs && !NekoConfig.isBottomNavigationBarHidden() ? dp(MAIN_TABS_HEIGHT_WITH_MARGINS) : 0;
|
||||||
additionFloatingButtonOffset = hasMainTabs && !NekoConfig.hideBottomNavigationBar ? dp(DialogsActivity.MAIN_TABS_HEIGHT + DialogsActivity.MAIN_TABS_MARGIN) : 0;
|
additionFloatingButtonOffset = hasMainTabs && !NekoConfig.isBottomNavigationBarHidden() ? dp(DialogsActivity.MAIN_TABS_HEIGHT + DialogsActivity.MAIN_TABS_MARGIN) : 0;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -3167,8 +3169,8 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View createView(final Context context) {
|
public View createView(final Context context) {
|
||||||
additionNavigationBarHeight = hasMainTabs && !NekoConfig.hideBottomNavigationBar ? dp(MAIN_TABS_HEIGHT_WITH_MARGINS) : 0;
|
additionNavigationBarHeight = hasMainTabs && !NekoConfig.isBottomNavigationBarHidden() ? dp(MAIN_TABS_HEIGHT_WITH_MARGINS) : 0;
|
||||||
additionFloatingButtonOffset = hasMainTabs && !NekoConfig.hideBottomNavigationBar ? dp(DialogsActivity.MAIN_TABS_HEIGHT + DialogsActivity.MAIN_TABS_MARGIN) : 0;
|
additionFloatingButtonOffset = hasMainTabs && !NekoConfig.isBottomNavigationBarHidden() ? dp(DialogsActivity.MAIN_TABS_HEIGHT + DialogsActivity.MAIN_TABS_MARGIN) : 0;
|
||||||
searching = false;
|
searching = false;
|
||||||
searchWas = false;
|
searchWas = false;
|
||||||
wasDrawn = false;
|
wasDrawn = false;
|
||||||
|
|
@ -3188,12 +3190,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||||
ActionBarMenu menu = actionBar.createMenu();
|
ActionBarMenu menu = actionBar.createMenu();
|
||||||
searchItem = menu.addItem(0, R.drawable.outline_header_search).setIsSearchField(true, false);
|
searchItem = menu.addItem(0, R.drawable.outline_header_search).setIsSearchField(true, false);
|
||||||
searchItem.setOnClickListener(v -> {
|
searchItem.setOnClickListener(v -> {
|
||||||
showSearch(true, false, true);
|
openSearch();
|
||||||
fragmentSearchFieldWatcher.toggleSearch(true);
|
|
||||||
AndroidUtilities.runOnUIThread(() -> {
|
|
||||||
fragmentSearchField.editText.requestFocus();
|
|
||||||
AndroidUtilities.showKeyboard(fragmentSearchField.editText);
|
|
||||||
}, 100);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
AnimatorSet animatorSet = new AnimatorSet();
|
AnimatorSet animatorSet = new AnimatorSet();
|
||||||
|
|
@ -4737,28 +4734,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||||
|
|
||||||
floatingButton3 = new FragmentFloatingButton(context, resourceProvider);
|
floatingButton3 = new FragmentFloatingButton(context, resourceProvider);
|
||||||
contentView.addView(floatingButton3, FragmentFloatingButton.createDefaultLayoutParams());
|
contentView.addView(floatingButton3, FragmentFloatingButton.createDefaultLayoutParams());
|
||||||
floatingButton3.setOnClickListener(v -> {
|
floatingButton3.setOnClickListener(v -> performComposeClick());
|
||||||
if (parentLayout != null && parentLayout.isInPreviewMode()) {
|
|
||||||
finishPreviewFragment();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (initialDialogsType == DIALOGS_TYPE_WIDGET) {
|
|
||||||
if (delegate == null || selectedDialogs.isEmpty()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ArrayList<MessagesStorage.TopicKey> topicKeys = new ArrayList<>();
|
|
||||||
for (int i = 0; i < selectedDialogs.size(); i++) {
|
|
||||||
topicKeys.add(MessagesStorage.TopicKey.of(selectedDialogs.get(i), 0));
|
|
||||||
}
|
|
||||||
delegate.didSelectDialogs(DialogsActivity.this, topicKeys, null, false, notify, scheduleDate, scheduleRepeatPeriod, null);
|
|
||||||
} else {
|
|
||||||
if (MessagesController.getInstance(currentAccount).isFrozen()) {
|
|
||||||
AccountFrozenAlert.show(currentAccount);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
openWriteContacts();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!isArchive() && initialDialogsType == DIALOGS_TYPE_DEFAULT) {
|
if (!isArchive() && initialDialogsType == DIALOGS_TYPE_DEFAULT) {
|
||||||
if (MessagesController.getInstance(currentAccount).getMainSettings().getBoolean("storyhint", true)) {
|
if (MessagesController.getInstance(currentAccount).getMainSettings().getBoolean("storyhint", true)) {
|
||||||
|
|
@ -5592,6 +5568,9 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||||
updateFilterTabs(true, false);
|
updateFilterTabs(true, false);
|
||||||
rightSlidingDialogContainer.setOpenProgress(0f);
|
rightSlidingDialogContainer.setOpenProgress(0f);
|
||||||
contentView.addView(dialogStoriesCell, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, DialogStoriesCell.HEIGHT_IN_DP));
|
contentView.addView(dialogStoriesCell, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, DialogStoriesCell.HEIGHT_IN_DP));
|
||||||
|
if (hasMainTabs && !onlySelect && folderId == 0 && searchString == null) {
|
||||||
|
// avatar removed: account switching is in bottom menu
|
||||||
|
}
|
||||||
contentView.addView(rightSlidingDialogContainer, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
|
contentView.addView(rightSlidingDialogContainer, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
|
||||||
|
|
||||||
dialogsActivityStatusLayout = new DialogsActivityStatusLayout(context);
|
dialogsActivityStatusLayout = new DialogsActivityStatusLayout(context);
|
||||||
|
|
@ -8773,7 +8752,11 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateFloatingButtonVisibility(boolean animated) {
|
private void updateFloatingButtonVisibility(boolean animated) {
|
||||||
final boolean isVisible = !(onlySelect && initialDialogsType != 10 || folderId != 0 || inPreviewMode || (searching && !onlySelect) || floatingButtonHidden);
|
boolean isVisible = !(onlySelect && initialDialogsType != 10 || folderId != 0 || inPreviewMode || (searching && !onlySelect) || floatingButtonHidden);
|
||||||
|
if (hasMainTabs && !NekoConfig.isBottomNavigationBarHidden()) {
|
||||||
|
// Compose action is hosted inside the bottom tabs bar
|
||||||
|
isVisible = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (floatingButton3 != null) {
|
if (floatingButton3 != null) {
|
||||||
floatingButton3.setButtonVisible(isVisible, animated);
|
floatingButton3.setButtonVisible(isVisible, animated);
|
||||||
|
|
@ -10493,6 +10476,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
updateStatus(UserConfig.getInstance(account).getCurrentUser(), true);
|
updateStatus(UserConfig.getInstance(account).getCurrentUser(), true);
|
||||||
|
updateMainTabsAvatar();
|
||||||
} else if (id == NotificationCenter.appDidLogout) {
|
} else if (id == NotificationCenter.appDidLogout) {
|
||||||
dialogsLoaded[currentAccount] = false;
|
dialogsLoaded[currentAccount] = false;
|
||||||
} else if (id == NotificationCenter.encryptedChatUpdated) {
|
} else if (id == NotificationCenter.encryptedChatUpdated) {
|
||||||
|
|
@ -11504,6 +11488,20 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||||
commentView.setFieldText(first.caption == null ? "" : first.caption);
|
commentView.setFieldText(first.caption == null ? "" : first.caption);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void openSearch() {
|
||||||
|
if (searchItem == null || searchIsShowed) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
showSearch(true, false, true);
|
||||||
|
fragmentSearchFieldWatcher.toggleSearch(true);
|
||||||
|
AndroidUtilities.runOnUIThread(() -> {
|
||||||
|
if (fragmentSearchField != null && fragmentSearchField.editText != null) {
|
||||||
|
fragmentSearchField.editText.requestFocus();
|
||||||
|
AndroidUtilities.showKeyboard(fragmentSearchField.editText);
|
||||||
|
}
|
||||||
|
}, 100);
|
||||||
|
}
|
||||||
|
|
||||||
public void setSearchString(String string) {
|
public void setSearchString(String string) {
|
||||||
searchString = string;
|
searchString = string;
|
||||||
}
|
}
|
||||||
|
|
@ -13340,6 +13338,29 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||||
}, 0);
|
}, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void performComposeClick() {
|
||||||
|
if (parentLayout != null && parentLayout.isInPreviewMode()) {
|
||||||
|
finishPreviewFragment();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (initialDialogsType == DIALOGS_TYPE_WIDGET) {
|
||||||
|
if (delegate == null || selectedDialogs.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ArrayList<MessagesStorage.TopicKey> topicKeys = new ArrayList<>();
|
||||||
|
for (int i = 0; i < selectedDialogs.size(); i++) {
|
||||||
|
topicKeys.add(MessagesStorage.TopicKey.of(selectedDialogs.get(i), 0));
|
||||||
|
}
|
||||||
|
delegate.didSelectDialogs(DialogsActivity.this, topicKeys, null, false, notify, scheduleDate, scheduleRepeatPeriod, null);
|
||||||
|
} else {
|
||||||
|
if (MessagesController.getInstance(currentAccount).isFrozen()) {
|
||||||
|
AccountFrozenAlert.show(currentAccount);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
openWriteContacts();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void openWriteContacts() {
|
private void openWriteContacts() {
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
args.putBoolean("destroyAfterSelect", true);
|
args.putBoolean("destroyAfterSelect", true);
|
||||||
|
|
@ -13525,7 +13546,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
io.addGap();
|
io.addGap();
|
||||||
if (NekoConfig.hideBottomNavigationBar) {
|
if (NekoConfig.isBottomNavigationBarHidden()) {
|
||||||
io.add(R.drawable.left_status_profile, getString(R.string.MyProfile), () -> {
|
io.add(R.drawable.left_status_profile, getString(R.string.MyProfile), () -> {
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
args.putLong("user_id", getUserConfig().getClientUserId());
|
args.putLong("user_id", getUserConfig().getClientUserId());
|
||||||
|
|
@ -13545,7 +13566,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
presentFragment(new GroupCreateActivity(args));
|
presentFragment(new GroupCreateActivity(args));
|
||||||
});
|
});
|
||||||
if (NekoConfig.hideBottomNavigationBar) {
|
if (NekoConfig.isBottomNavigationBarHidden()) {
|
||||||
io.add(R.drawable.msg_contacts, getString(R.string.Contacts), () -> {
|
io.add(R.drawable.msg_contacts, getString(R.string.Contacts), () -> {
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
args.putBoolean("needPhonebook", true);
|
args.putBoolean("needPhonebook", true);
|
||||||
|
|
@ -13588,12 +13609,12 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (NekoConfig.hideBottomNavigationBar || getUserConfig().showCallsTab) {
|
if (NekoConfig.isBottomNavigationBarHidden() || getUserConfig().showCallsTab) {
|
||||||
io.add(R.drawable.msg_settings_old, getString(R.string.Settings), () -> {
|
io.add(R.drawable.msg_settings_old, getString(R.string.Settings), () -> {
|
||||||
presentFragment(new SettingsActivity());
|
presentFragment(new SettingsActivity());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (NekoConfig.hideBottomNavigationBar) {
|
if (NekoConfig.isBottomNavigationBarHidden()) {
|
||||||
PopupHelper.fillAccountSelectorMenu(io, currentAccount, getParentActivity(), resourceProvider);
|
PopupHelper.fillAccountSelectorMenu(io, currentAccount, getParentActivity(), resourceProvider);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -13890,6 +13911,18 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||||
checkUi_itemSpeedVisibility();
|
checkUi_itemSpeedVisibility();
|
||||||
checkUi_itemPasscodeVisibility();
|
checkUi_itemPasscodeVisibility();
|
||||||
checkUi_itemSearchVisibility();
|
checkUi_itemSearchVisibility();
|
||||||
|
checkUi_mainTabsAvatarVisibility();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkUi_mainTabsAvatarVisibility() {
|
||||||
|
if (mainTabsAvatarButton == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final float factor1 = 1f - animatorSearchVisible.getFloatValue();
|
||||||
|
final float factor2 = 1f - getRightSlidingProgress();
|
||||||
|
final float factor3 = 1f - animatorDoneButtonVisible.getFloatValue();
|
||||||
|
final float factor = factor1 * factor2 * factor3;
|
||||||
|
FragmentFloatingButton.setAnimatedVisibility(mainTabsAvatarButton, factor);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkUi_itemBackButtonVisibility() {
|
private void checkUi_itemBackButtonVisibility() {
|
||||||
|
|
@ -13940,7 +13973,8 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkUi_itemSearchVisibility() {
|
private void checkUi_itemSearchVisibility() {
|
||||||
final float factor0 = isSupportSearch() ? 1 : 0;
|
// Hide the top-right search icon in MainTabs mode (search lives in bottom menu)
|
||||||
|
final float factor0 = (isSupportSearch() && !(hasMainTabs && !NekoConfig.isBottomNavigationBarHidden())) ? 1 : 0;
|
||||||
final float factor1 = animatorSearchButtonVisible.getFloatValue();
|
final float factor1 = animatorSearchButtonVisible.getFloatValue();
|
||||||
final float factor2 = 1f - getRightSlidingProgress();
|
final float factor2 = 1f - getRightSlidingProgress();
|
||||||
final float factor3 = 1f - animatorDoneButtonVisible.getFloatValue();
|
final float factor3 = 1f - animatorDoneButtonVisible.getFloatValue();
|
||||||
|
|
@ -14003,7 +14037,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||||
iBlur3PositionActionBar.set(0, -additionalList, fragmentView.getMeasuredWidth(), lerp(actionBarHeight, actionBarHeightSearch, animatorSearchVisible.getFloatValue()) + additionalList );
|
iBlur3PositionActionBar.set(0, -additionalList, fragmentView.getMeasuredWidth(), lerp(actionBarHeight, actionBarHeightSearch, animatorSearchVisible.getFloatValue()) + additionalList );
|
||||||
|
|
||||||
boolean hasBottomBlur = false;
|
boolean hasBottomBlur = false;
|
||||||
if (hasMainTabs && !NekoConfig.hideBottomNavigationBar) {
|
if (hasMainTabs && !NekoConfig.isBottomNavigationBarHidden()) {
|
||||||
iBlur3PositionMainTabs.set(0, mainTabTop, fragmentView.getMeasuredWidth(), mainTabBottom);
|
iBlur3PositionMainTabs.set(0, mainTabTop, fragmentView.getMeasuredWidth(), mainTabBottom);
|
||||||
iBlur3PositionMainTabs.inset(0, LiteMode.isEnabled(LiteMode.FLAG_LIQUID_GLASS) ? 0 : -dp(48));
|
iBlur3PositionMainTabs.inset(0, LiteMode.isEnabled(LiteMode.FLAG_LIQUID_GLASS) ? 0 : -dp(48));
|
||||||
|
|
||||||
|
|
@ -14109,7 +14143,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
float height = dp(FILTER_TABS_HEIGHT + 7);
|
float height = dp(FILTER_TABS_HEIGHT + 7);
|
||||||
if (!floatingButton && NekoConfig.hideBottomNavigationBar) {
|
if (!floatingButton && NekoConfig.isBottomNavigationBarHidden()) {
|
||||||
height += dp(7);
|
height += dp(7);
|
||||||
}
|
}
|
||||||
height *= filterTabsView.getAlpha();
|
height *= filterTabsView.getAlpha();
|
||||||
|
|
@ -14123,7 +14157,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||||
float bottom = navigationBarHeight + additionNavigationBarHeight;
|
float bottom = navigationBarHeight + additionNavigationBarHeight;
|
||||||
if (commentView != null && chatInputViewsContainer != null) {
|
if (commentView != null && chatInputViewsContainer != null) {
|
||||||
bottom += lerp(0, dp(9) + chatInputViewsContainer.getInputBubbleHeight() + dp(2), chatInputViewsContainer.getAlpha());
|
bottom += lerp(0, dp(9) + chatInputViewsContainer.getInputBubbleHeight() + dp(2), chatInputViewsContainer.getAlpha());
|
||||||
} else if (!NekoConfig.hideBottomNavigationBar) {
|
} else if (!NekoConfig.isBottomNavigationBarHidden()) {
|
||||||
bottom -= dp(MAIN_TABS_MARGIN);
|
bottom -= dp(MAIN_TABS_MARGIN);
|
||||||
}
|
}
|
||||||
filterTabsView.setTranslationY(-bottom);
|
filterTabsView.setTranslationY(-bottom);
|
||||||
|
|
@ -14168,6 +14202,51 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void createMainTabsAvatar(Context context, ViewGroup parent) {
|
||||||
|
if (mainTabsAvatarButton != null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mainTabsAvatarButton = new FrameLayout(context);
|
||||||
|
mainTabsAvatarButton.setBackground(Theme.createSelectorDrawable(getThemedColor(Theme.key_actionBarActionModeDefaultSelector), 1, dp(20)));
|
||||||
|
mainTabsAvatarButton.setContentDescription(getString(R.string.MainTabsProfile));
|
||||||
|
|
||||||
|
mainTabsAvatarImage = new BackupImageView(context);
|
||||||
|
mainTabsAvatarImage.setRoundRadius(dp(18));
|
||||||
|
mainTabsAvatarButton.addView(mainTabsAvatarImage, LayoutHelper.createFrame(36, 36, Gravity.CENTER));
|
||||||
|
|
||||||
|
mainTabsAvatarButton.setOnClickListener(this::openAccountSelector);
|
||||||
|
mainTabsAvatarButton.setOnLongClickListener(this::openAccountSelector);
|
||||||
|
|
||||||
|
// Added on top of the stories cell so it stays visible at the top-left.
|
||||||
|
parent.addView(mainTabsAvatarButton, LayoutHelper.createFrame(40, 40, Gravity.LEFT | Gravity.TOP, 8, 0, 0, 0));
|
||||||
|
mainTabsAvatarButton.post(this::updateMainTabsAvatarPosition);
|
||||||
|
|
||||||
|
updateMainTabsAvatar();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateMainTabsAvatarPosition() {
|
||||||
|
if (mainTabsAvatarButton == null || dialogStoriesCell == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Center the avatar vertically within the stories row and follow its translationY
|
||||||
|
final float storiesTop = dialogStoriesCell.getTop() + dialogStoriesCell.getTranslationY();
|
||||||
|
final float storiesHeight = dp(DialogStoriesCell.HEIGHT_IN_DP);
|
||||||
|
final float top = storiesTop + (storiesHeight - dp(40)) / 2f;
|
||||||
|
mainTabsAvatarButton.setTranslationY(top);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateMainTabsAvatar() {
|
||||||
|
if (mainTabsAvatarImage == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final TLRPC.User user = getUserConfig().getCurrentUser();
|
||||||
|
final AvatarDrawable avatarDrawable = new AvatarDrawable();
|
||||||
|
avatarDrawable.setInfo(currentAccount, user);
|
||||||
|
final Drawable thumb = user != null && user.photo != null && user.photo.strippedBitmap != null ? user.photo.strippedBitmap : avatarDrawable;
|
||||||
|
mainTabsAvatarImage.getImageReceiver().setCurrentAccount(currentAccount);
|
||||||
|
mainTabsAvatarImage.setImage(ImageLocation.getForUserOrChat(currentAccount, user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", thumb, user);
|
||||||
|
}
|
||||||
|
|
||||||
public LinearLayout accountView(int account, boolean selected) {
|
public LinearLayout accountView(int account, boolean selected) {
|
||||||
final LinearLayout btn = new LinearLayout(getContext());
|
final LinearLayout btn = new LinearLayout(getContext());
|
||||||
btn.setOrientation(LinearLayout.HORIZONTAL);
|
btn.setOrientation(LinearLayout.HORIZONTAL);
|
||||||
|
|
@ -14236,6 +14315,29 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||||
});
|
});
|
||||||
|
|
||||||
ItemOptions o = ItemOptions.makeOptions(this, view);
|
ItemOptions o = ItemOptions.makeOptions(this, view);
|
||||||
|
if (UserConfig.getActivatedAccountsCount() < UserConfig.MAX_ACCOUNT_COUNT) {
|
||||||
|
o.add(R.drawable.msg_addbot, getString(R.string.AddAccount), () -> {
|
||||||
|
o.dismiss();
|
||||||
|
int freeAccounts = 0;
|
||||||
|
Integer availableAccount = null;
|
||||||
|
for (int a = UserConfig.MAX_ACCOUNT_COUNT - 1; a >= 0; a--) {
|
||||||
|
if (!UserConfig.getInstance(a).isClientActivated()) {
|
||||||
|
freeAccounts++;
|
||||||
|
if (availableAccount == null) {
|
||||||
|
availableAccount = a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!UserConfig.hasPremiumOnAccounts()) {
|
||||||
|
freeAccounts -= (UserConfig.MAX_ACCOUNT_COUNT - UserConfig.MAX_ACCOUNT_DEFAULT_COUNT);
|
||||||
|
}
|
||||||
|
if (freeAccounts > 0 && availableAccount != null) {
|
||||||
|
presentFragment(new LoginActivity(availableAccount));
|
||||||
|
} else if (!UserConfig.hasPremiumOnAccounts()) {
|
||||||
|
showDialog(new LimitReachedBottomSheet(this, getContext(), TYPE_ACCOUNTS, currentAccount, null));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
if (accountNumbers.size() > 0) {
|
if (accountNumbers.size() > 0) {
|
||||||
if (o.getItemsCount() > 0) o.addGap();
|
if (o.getItemsCount() > 0) o.addGap();
|
||||||
for (int acc : accountNumbers) {
|
for (int acc : accountNumbers) {
|
||||||
|
|
@ -14274,7 +14376,13 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||||
o.setViewAdditionalOffsets(-dp(4), -dp(4), -dp(4), -dp(4));
|
o.setViewAdditionalOffsets(-dp(4), -dp(4), -dp(4), -dp(4));
|
||||||
o.setScrimViewBackground(bg);
|
o.setScrimViewBackground(bg);
|
||||||
o.translate(0, -dp(4));
|
o.translate(0, -dp(4));
|
||||||
o.setGravity(Gravity.RIGHT);
|
boolean anchorOnLeft = false;
|
||||||
|
if (view != null && fragmentView != null) {
|
||||||
|
final int[] loc = new int[2];
|
||||||
|
view.getLocationInWindow(loc);
|
||||||
|
anchorOnLeft = loc[0] + view.getWidth() / 2f < fragmentView.getWidth() / 2f;
|
||||||
|
}
|
||||||
|
o.setGravity(anchorOnLeft ? Gravity.LEFT : Gravity.RIGHT);
|
||||||
o.show();
|
o.show();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -577,6 +577,10 @@ public class PeerStoriesView extends SizeNotifierFrameLayout implements Notifica
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void dispatchDraw(Canvas canvas) {
|
protected void dispatchDraw(Canvas canvas) {
|
||||||
|
if (!isActive) {
|
||||||
|
headerView.backupImageView.getImageReceiver().setVisible(true, true);
|
||||||
|
}
|
||||||
|
|
||||||
if (!unsupported) {
|
if (!unsupported) {
|
||||||
if (playerSharedScope.renderView != null || storyAreasView != null && (storyAreasView.hasSelectedForScale() || storyAreasView.parentHighlightScaleAlpha.isInProgress())) {
|
if (playerSharedScope.renderView != null || storyAreasView != null && (storyAreasView.hasSelectedForScale() || storyAreasView.parentHighlightScaleAlpha.isInProgress())) {
|
||||||
invalidate();
|
invalidate();
|
||||||
|
|
@ -4222,6 +4226,7 @@ public class PeerStoriesView extends SizeNotifierFrameLayout implements Notifica
|
||||||
isPremiumBlocked = !UserConfig.getInstance(currentAccount).isPremium() && DialogObject.isPremiumBlocked(r);
|
isPremiumBlocked = !UserConfig.getInstance(currentAccount).isPremium() && DialogObject.isPremiumBlocked(r);
|
||||||
starsPriceBlocked = DialogObject.getMessagesStarsPrice(r);
|
starsPriceBlocked = DialogObject.getMessagesStarsPrice(r);
|
||||||
avatarDrawable.setInfo(currentAccount, user);
|
avatarDrawable.setInfo(currentAccount, user);
|
||||||
|
headerView.backupImageView.getImageReceiver().setForUserOrChat(user, avatarDrawable);
|
||||||
setTitle(true, dialogId, false);
|
setTitle(true, dialogId, false);
|
||||||
} else {
|
} else {
|
||||||
isSelf = false;
|
isSelf = false;
|
||||||
|
|
@ -4238,6 +4243,7 @@ public class PeerStoriesView extends SizeNotifierFrameLayout implements Notifica
|
||||||
isPremiumBlocked = isGroup && !ChatObject.canSendPlain(chat);
|
isPremiumBlocked = isGroup && !ChatObject.canSendPlain(chat);
|
||||||
starsPriceBlocked = MessagesController.getInstance(currentAccount).getSendPaidMessagesStars(dialogId);
|
starsPriceBlocked = MessagesController.getInstance(currentAccount).getSendPaidMessagesStars(dialogId);
|
||||||
avatarDrawable.setInfo(currentAccount, chat);
|
avatarDrawable.setInfo(currentAccount, chat);
|
||||||
|
headerView.backupImageView.getImageReceiver().setForUserOrChat(chat, avatarDrawable);
|
||||||
setTitle(true, dialogId, false);
|
setTitle(true, dialogId, false);
|
||||||
}
|
}
|
||||||
if (isActive && (isSelf || isChannel)) {
|
if (isActive && (isSelf || isChannel)) {
|
||||||
|
|
@ -5160,6 +5166,7 @@ public class PeerStoriesView extends SizeNotifierFrameLayout implements Notifica
|
||||||
if (headerView.radialProgress != null) {
|
if (headerView.radialProgress != null) {
|
||||||
headerView.radialProgress.setProgress(currentStory.uploadingStory.progress, false);
|
headerView.radialProgress.setProgress(currentStory.uploadingStory.progress, false);
|
||||||
}
|
}
|
||||||
|
headerView.backupImageView.invalidate();
|
||||||
} else if (!animateSubtitle) {
|
} else if (!animateSubtitle) {
|
||||||
headerView.progressToUploading = 0;
|
headerView.progressToUploading = 0;
|
||||||
}
|
}
|
||||||
|
|
@ -6296,6 +6303,7 @@ public class PeerStoriesView extends SizeNotifierFrameLayout implements Notifica
|
||||||
updatePreloadImages();
|
updatePreloadImages();
|
||||||
muteIconView.setAnimation(sharedResources.muteDrawable);
|
muteIconView.setAnimation(sharedResources.muteDrawable);
|
||||||
isActive = true;
|
isActive = true;
|
||||||
|
headerView.backupImageView.getImageReceiver().setVisible(true, true);
|
||||||
if (currentStory.storyItem != null) {
|
if (currentStory.storyItem != null) {
|
||||||
FileLog.d("StoryViewer displayed story dialogId=" + dialogId + " storyId=" + currentStory.storyItem.id + " " + currentStory.getMediaDebugString());
|
FileLog.d("StoryViewer displayed story dialogId=" + dialogId + " storyId=" + currentStory.storyItem.id + " " + currentStory.getMediaDebugString());
|
||||||
}
|
}
|
||||||
|
|
@ -6329,6 +6337,7 @@ public class PeerStoriesView extends SizeNotifierFrameLayout implements Notifica
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reset() {
|
public void reset() {
|
||||||
|
headerView.backupImageView.getImageReceiver().setVisible(true, true);
|
||||||
if (changeBoundAnimator != null) {
|
if (changeBoundAnimator != null) {
|
||||||
chatActivityEnterView.reset();
|
chatActivityEnterView.reset();
|
||||||
chatActivityEnterView.setAlpha(1f - outT);
|
chatActivityEnterView.setAlpha(1f - outT);
|
||||||
|
|
@ -6606,6 +6615,7 @@ public class PeerStoriesView extends SizeNotifierFrameLayout implements Notifica
|
||||||
|
|
||||||
public static class PeerHeaderView extends FrameLayout {
|
public static class PeerHeaderView extends FrameLayout {
|
||||||
|
|
||||||
|
public BackupImageView backupImageView;
|
||||||
public SimpleTextView titleView;
|
public SimpleTextView titleView;
|
||||||
private TextView[] subtitleView = new TextView[2];
|
private TextView[] subtitleView = new TextView[2];
|
||||||
RadialProgress radialProgress;
|
RadialProgress radialProgress;
|
||||||
|
|
@ -6619,6 +6629,18 @@ public class PeerStoriesView extends SizeNotifierFrameLayout implements Notifica
|
||||||
public PeerHeaderView(@NonNull Context context, StoryItemHolder holder) {
|
public PeerHeaderView(@NonNull Context context, StoryItemHolder holder) {
|
||||||
super(context);
|
super(context);
|
||||||
this.storyItemHolder = holder;
|
this.storyItemHolder = holder;
|
||||||
|
backupImageView = new BackupImageView(context) {
|
||||||
|
@Override
|
||||||
|
protected void onDraw(Canvas canvas) {
|
||||||
|
if (imageReceiver.getVisible()) {
|
||||||
|
AndroidUtilities.rectTmp.set(0, 0, getMeasuredWidth(), getMeasuredHeight());
|
||||||
|
drawUploadingProgress(canvas, AndroidUtilities.rectTmp, true, 1f);
|
||||||
|
}
|
||||||
|
super.onDraw(canvas);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
backupImageView.setRoundRadius(dp(16));
|
||||||
|
addView(backupImageView, LayoutHelper.createFrame(32, 32, 0, 12, 2, 0, 0));
|
||||||
setClipChildren(false);
|
setClipChildren(false);
|
||||||
|
|
||||||
titleView = new SimpleTextView(context) {
|
titleView = new SimpleTextView(context) {
|
||||||
|
|
@ -6636,7 +6658,7 @@ public class PeerStoriesView extends SizeNotifierFrameLayout implements Notifica
|
||||||
// titleView.setSingleLine(true);
|
// titleView.setSingleLine(true);
|
||||||
// titleView.setEllipsize(TextUtils.TruncateAt.END);
|
// titleView.setEllipsize(TextUtils.TruncateAt.END);
|
||||||
NotificationCenter.listenEmojiLoading(titleView);
|
NotificationCenter.listenEmojiLoading(titleView);
|
||||||
addView(titleView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, 0, 12, 0, 86, 0));
|
addView(titleView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, 0, 54, 0, 86, 0));
|
||||||
|
|
||||||
for (int a = 0; a < 2; ++a) {
|
for (int a = 0; a < 2; ++a) {
|
||||||
subtitleView[a] = new TextView(context);
|
subtitleView[a] = new TextView(context);
|
||||||
|
|
@ -6646,7 +6668,7 @@ public class PeerStoriesView extends SizeNotifierFrameLayout implements Notifica
|
||||||
subtitleView[a].setEllipsize(TextUtils.TruncateAt.MIDDLE);
|
subtitleView[a].setEllipsize(TextUtils.TruncateAt.MIDDLE);
|
||||||
subtitleView[a].setTextColor(Color.WHITE);
|
subtitleView[a].setTextColor(Color.WHITE);
|
||||||
subtitleView[a].setPadding(dp(3), 0, dp(3), dp(1));
|
subtitleView[a].setPadding(dp(3), 0, dp(3), dp(1));
|
||||||
addView(subtitleView[a], LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, 0, 9, 18, 83, 0));
|
addView(subtitleView[a], LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, 0, 51, 18, 83, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
titleView.setTextColor(Color.WHITE);
|
titleView.setTextColor(Color.WHITE);
|
||||||
|
|
@ -6736,10 +6758,11 @@ public class PeerStoriesView extends SizeNotifierFrameLayout implements Notifica
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (radialProgress == null) {
|
if (radialProgress == null) {
|
||||||
radialProgress = new RadialProgress(null);
|
radialProgress = new RadialProgress(backupImageView);
|
||||||
radialProgress.setBackground(null, true, false);
|
radialProgress.setBackground(null, true, false);
|
||||||
}
|
}
|
||||||
radialProgress.setDiff(0);
|
radialProgress.setDiff(0);
|
||||||
|
ImageReceiver imageReceiver = backupImageView.getImageReceiver();
|
||||||
float offset = AndroidUtilities.dp(3) - AndroidUtilities.dp(6) * (1f - progressToUploading);
|
float offset = AndroidUtilities.dp(3) - AndroidUtilities.dp(6) * (1f - progressToUploading);
|
||||||
radialProgress.setProgressRect(
|
radialProgress.setProgressRect(
|
||||||
(int) (rect.left - offset), (int) (rect.top - offset),
|
(int) (rect.left - offset), (int) (rect.top - offset),
|
||||||
|
|
@ -6751,7 +6774,7 @@ public class PeerStoriesView extends SizeNotifierFrameLayout implements Notifica
|
||||||
}
|
}
|
||||||
if (allowDraw) {
|
if (allowDraw) {
|
||||||
if (progressToOpen != 1f) {
|
if (progressToOpen != 1f) {
|
||||||
Paint paint = StoriesUtilities.getUnreadCirclePaint(rect, false);
|
Paint paint = StoriesUtilities.getUnreadCirclePaint(imageReceiver, false);
|
||||||
paint.setAlpha((int) (255 * progressToUploading));
|
paint.setAlpha((int) (255 * progressToUploading));
|
||||||
radialProgress.setPaint(paint);
|
radialProgress.setPaint(paint);
|
||||||
radialProgress.draw(canvas);
|
radialProgress.draw(canvas);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue