use of org.telegram.ui.Cells.GroupCallInvitedCell in project Telegram-FOSS by Telegram-FOSS-Team.
the class GroupCallActivity method applyCallParticipantUpdates.
private void applyCallParticipantUpdates(boolean animated) {
if (renderersContainer.inFullscreenMode) {
renderersContainer.setVisibleParticipant(true);
}
if (call == null || delayedGroupCallUpdated) {
return;
}
long self = MessageObject.getPeerId(call.selfPeer);
long dummyPeer = MessageObject.getPeerId(selfPeer);
if (self != dummyPeer && call.participants.get(self) != null) {
selfPeer = call.selfPeer;
}
int count = listView.getChildCount();
View minChild = null;
int minPosition = 0;
int minTop = Integer.MAX_VALUE;
for (int a = 0; a < count; a++) {
View child = listView.getChildAt(a);
RecyclerView.ViewHolder holder = listView.findContainingViewHolder(child);
if (holder != null && holder.getAdapterPosition() != RecyclerView.NO_POSITION && holder.getLayoutPosition() != RecyclerView.NO_POSITION) {
if (minChild == null || child.getTop() < minTop) {
minChild = child;
minPosition = holder.getLayoutPosition();
minTop = child.getTop();
}
}
}
updateVideoParticipantList();
if (listView.getItemAnimator() != null && !animated) {
listView.setItemAnimator(null);
} else if (listView.getItemAnimator() == null && animated) {
listView.setItemAnimator(itemAnimator);
}
try {
UpdateCallback updateCallback = new UpdateCallback(listAdapter);
setOldRows(listAdapter.addMemberRow, listAdapter.usersStartRow, listAdapter.usersEndRow, listAdapter.invitedStartRow, listAdapter.invitedEndRow, listAdapter.usersVideoGridStartRow, listAdapter.usersVideoGridEndRow, listAdapter.videoGridDividerRow, listAdapter.videoNotAvailableRow);
listAdapter.updateRows();
DiffUtil.calculateDiff(diffUtilsCallback).dispatchUpdatesTo(updateCallback);
} catch (Exception e) {
FileLog.e(e);
listAdapter.notifyDataSetChanged();
}
call.saveActiveDates();
if (minChild != null) {
layoutManager.scrollToPositionWithOffset(minPosition, minChild.getTop() - listView.getPaddingTop());
}
oldParticipants.clear();
oldParticipants.addAll(call.visibleParticipants);
oldVideoParticipants.clear();
oldVideoParticipants.addAll(visibleVideoParticipants);
oldInvited.clear();
oldInvited.addAll(call.invitedUsers);
oldCount = listAdapter.getItemCount();
for (int a = 0; a < count; a++) {
View child = listView.getChildAt(a);
if (child instanceof GroupCallUserCell || child instanceof GroupCallInvitedCell) {
RecyclerView.ViewHolder holder = listView.findContainingViewHolder(child);
if (holder != null) {
if (child instanceof GroupCallUserCell) {
((GroupCallUserCell) child).setDrawDivider(holder.getAdapterPosition() != listAdapter.getItemCount() - 2);
} else {
((GroupCallInvitedCell) child).setDrawDivider(holder.getAdapterPosition() != listAdapter.getItemCount() - 2);
}
}
}
}
boolean autoPinEnabled = renderersContainer.autoPinEnabled();
if (renderersContainer.inFullscreenMode && renderersContainer.fullscreenParticipant != null && !ChatObject.Call.videoIsActive(renderersContainer.fullscreenParticipant.participant, renderersContainer.fullscreenParticipant.presentation, call)) {
boolean foundAnotherVideoParticipant = false;
if (!visibleVideoParticipants.isEmpty()) {
foundAnotherVideoParticipant = true;
if (autoPinEnabled) {
fullscreenFor(visibleVideoParticipants.get(0));
}
}
if (!foundAnotherVideoParticipant) {
fullscreenFor(null);
}
}
fullscreenAdapter.update(true, fullscreenUsersListView);
if (fullscreenUsersListView.getVisibility() == View.VISIBLE) {
AndroidUtilities.updateVisibleRows(fullscreenUsersListView);
}
if (isTabletMode) {
tabletGridAdapter.update(true, tabletVideoGridView);
}
if (listView.getVisibility() == View.VISIBLE) {
AndroidUtilities.updateVisibleRows(listView);
}
attachedRenderersTmp.clear();
attachedRenderersTmp.addAll(attachedRenderers);
for (int i = 0; i < attachedRenderersTmp.size(); i++) {
attachedRenderersTmp.get(i).updateAttachState(true);
}
if (call != null && renderersContainer.inFullscreenMode && renderersContainer.fullscreenParticipant != null && call.participants.get(MessageObject.getPeerId(renderersContainer.fullscreenParticipant.participant.peer)) == null) {
autoPinEnabled = true;
}
boolean hasVideoLocal = !call.visibleVideoParticipants.isEmpty();
if (hasVideoLocal != hasVideo) {
hasVideo = hasVideoLocal;
if (isTabletMode) {
containerView.requestLayout();
}
}
}
use of org.telegram.ui.Cells.GroupCallInvitedCell in project Telegram-FOSS by Telegram-FOSS-Team.
the class GroupCallActivity method setColorProgress.
private void setColorProgress(float progress) {
colorProgress = progress;
float finalColorProgress = colorProgress;
float finalColorProgress2 = Math.max(colorProgress, renderersContainer == null ? 0 : renderersContainer.progressToFullscreenMode);
backgroundColor = AndroidUtilities.getOffsetColor(Theme.getColor(Theme.key_voipgroup_actionBarUnscrolled), Theme.getColor(Theme.key_voipgroup_actionBar), finalColorProgress, 1.0f);
actionBarBackground.setBackgroundColor(backgroundColor);
otherItem.redrawPopup(0xff232A33);
shadowDrawable.setColorFilter(new PorterDuffColorFilter(backgroundColor, PorterDuff.Mode.MULTIPLY));
navBarColor = AndroidUtilities.getOffsetColor(Theme.getColor(Theme.key_voipgroup_actionBarUnscrolled), Theme.getColor(Theme.key_voipgroup_actionBar), finalColorProgress2, 1.0f);
int color = AndroidUtilities.getOffsetColor(Theme.getColor(Theme.key_voipgroup_listViewBackgroundUnscrolled), Theme.getColor(Theme.key_voipgroup_listViewBackground), finalColorProgress, 1.0f);
listViewBackgroundPaint.setColor(color);
listView.setGlowColor(color);
if (muteButtonState == MUTE_BUTTON_STATE_CONNECTING || isGradientState(muteButtonState)) {
muteButton.invalidate();
}
if (buttonsBackgroundGradientView != null) {
gradientColors[0] = backgroundColor;
gradientColors[1] = Color.TRANSPARENT;
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.Q) {
buttonsBackgroundGradient.setColors(gradientColors);
} else {
buttonsBackgroundGradientView.setBackground(buttonsBackgroundGradient = new GradientDrawable(GradientDrawable.Orientation.BOTTOM_TOP, gradientColors));
}
buttonsBackgroundGradientView2.setBackgroundColor(gradientColors[0]);
}
color = AndroidUtilities.getOffsetColor(Theme.getColor(Theme.key_voipgroup_leaveButton), Theme.getColor(Theme.key_voipgroup_leaveButtonScrolled), finalColorProgress, 1.0f);
leaveButton.setBackgroundColor(color, color);
color = AndroidUtilities.getOffsetColor(Theme.getColor(Theme.key_voipgroup_lastSeenTextUnscrolled), Theme.getColor(Theme.key_voipgroup_lastSeenText), finalColorProgress, 1.0f);
int color2 = AndroidUtilities.getOffsetColor(Theme.getColor(Theme.key_voipgroup_mutedIconUnscrolled), Theme.getColor(Theme.key_voipgroup_mutedIcon), finalColorProgress, 1.0f);
for (int a = 0, N = listView.getChildCount(); a < N; a++) {
View child = listView.getChildAt(a);
if (child instanceof GroupCallTextCell) {
GroupCallTextCell cell = (GroupCallTextCell) child;
cell.setColors(color2, color);
} else if (child instanceof GroupCallUserCell) {
GroupCallUserCell cell = (GroupCallUserCell) child;
cell.setGrayIconColor(actionBar.getTag() != null ? Theme.key_voipgroup_mutedIcon : Theme.key_voipgroup_mutedIconUnscrolled, color2);
} else if (child instanceof GroupCallInvitedCell) {
GroupCallInvitedCell cell = (GroupCallInvitedCell) child;
cell.setGrayIconColor(actionBar.getTag() != null ? Theme.key_voipgroup_mutedIcon : Theme.key_voipgroup_mutedIconUnscrolled, color2);
}
}
containerView.invalidate();
listView.invalidate();
container.invalidate();
}
Aggregations