org.telegram.ui.Cells.DialogCell Java Examples

The following examples show how to use org.telegram.ui.Cells.DialogCell. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ThemePreviewActivity.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public void didReceivedNotification(int id, int account, Object... args) {
    if (id == NotificationCenter.emojiDidLoaded) {
        if (listView == null) {
            return;
        }
        int count = listView.getChildCount();
        for (int a = 0; a < count; a++) {
            View child = listView.getChildAt(a);
            if (child instanceof DialogCell) {
                DialogCell cell = (DialogCell) child;
                cell.update(0);
            }
        }
    }
}
 
Example #2
Source File: DialogsAdapter.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
public void addOrRemoveSelectedDialog(long did, View cell)
{
    if (selectedDialogs.contains(did))
    {
        selectedDialogs.remove(did);
        if (cell instanceof DialogCell)
        {
            ((DialogCell) cell).setChecked(false, true);
        }
    }
    else
    {
        selectedDialogs.add(did);
        if (cell instanceof DialogCell)
        {
            ((DialogCell) cell).setChecked(true, true);
        }
    }
}
 
Example #3
Source File: ThemePreviewActivity.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public void didReceivedNotification(int id, int account, Object... args) {
    if (id == NotificationCenter.emojiDidLoaded) {
        if (listView == null) {
            return;
        }
        int count = listView.getChildCount();
        for (int a = 0; a < count; a++) {
            View child = listView.getChildAt(a);
            if (child instanceof DialogCell) {
                DialogCell cell = (DialogCell) child;
                cell.update(0);
            }
        }
    }
}
 
Example #4
Source File: DialogsAdapter.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
public void addOrRemoveSelectedDialog(long did, View cell)
{
    if (selectedDialogs.contains(did))
    {
        selectedDialogs.remove(did);
        if (cell instanceof DialogCell)
        {
            ((DialogCell) cell).setChecked(false, true);
        }
    }
    else
    {
        selectedDialogs.add(did);
        if (cell instanceof DialogCell)
        {
            ((DialogCell) cell).setChecked(true, true);
        }
    }
}
 
Example #5
Source File: ThemePreviewActivity.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int i) {
    if (viewHolder.getItemViewType() == 0) {
        DialogCell cell = (DialogCell) viewHolder.itemView;
        cell.useSeparator = (i != getItemCount() - 1);
        cell.setDialog(dialogs.get(i));
    }
}
 
Example #6
Source File: DialogsItemAnimator.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean animateChange(ViewHolder oldHolder, ViewHolder newHolder,ItemHolderInfo info, int fromX, int fromY, int toX, int toY) {
    if (oldHolder.itemView instanceof DialogCell) {
        resetAnimation(oldHolder);
        resetAnimation(newHolder);
        oldHolder.itemView.setAlpha(1.0f);
        newHolder.itemView.setAlpha(0.0f);
        newHolder.itemView.setTranslationX(0.0f);
        mPendingChanges.add(new ChangeInfo(oldHolder, newHolder, fromX, fromY, toX, toY));
        return true;
    }
    return false;
}
 
Example #7
Source File: DialogsItemAnimator.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean animateAdd(final ViewHolder holder) {
    resetAnimation(holder);
    if (holder.itemView instanceof DialogCell) {
        ((DialogCell) holder.itemView).setClipProgress(1.0f);
    } else {
        holder.itemView.setAlpha(0);
    }
    mPendingAdditions.add(holder);
    return true;
}
 
Example #8
Source File: ThemePreviewActivity.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int i) {
    if (viewHolder.getItemViewType() == 0) {
        DialogCell cell = (DialogCell) viewHolder.itemView;
        cell.useSeparator = (i != getItemCount() - 1);
        cell.setDialog(dialogs.get(i));
    }
}
 
Example #9
Source File: DialogsAdapter.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onViewAttachedToWindow(RecyclerView.ViewHolder holder) {
    if (holder.itemView instanceof DialogCell) {
        DialogCell dialogCell = (DialogCell) holder.itemView;
        dialogCell.onReorderStateChanged(isReordering, false);
        int position = fixPosition(holder.getAdapterPosition());
        dialogCell.setDialogIndex(position);
        dialogCell.checkCurrentDialogIndex(dialogsListFrozen);
        dialogCell.setChecked(selectedDialogs.contains(dialogCell.getDialogId()), false);
    }
}
 
Example #10
Source File: MessagesSearchAdapter.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
    if (holder.getItemViewType() == 0) {
        DialogCell cell = (DialogCell) holder.itemView;
        cell.useSeparator = true;
        MessageObject messageObject = (MessageObject) getItem(position);
        cell.setDialog(messageObject.getDialogId(), messageObject, messageObject.messageOwner.date, true);
    }
}
 
Example #11
Source File: DialogsItemAnimator.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean animateChange(ViewHolder oldHolder, ViewHolder newHolder,ItemHolderInfo info, int fromX, int fromY, int toX, int toY) {
    if (oldHolder.itemView instanceof DialogCell) {
        resetAnimation(oldHolder);
        resetAnimation(newHolder);
        oldHolder.itemView.setAlpha(1.0f);
        newHolder.itemView.setAlpha(0.0f);
        newHolder.itemView.setTranslationX(0.0f);
        mPendingChanges.add(new ChangeInfo(oldHolder, newHolder, fromX, fromY, toX, toY));
        return true;
    }
    return false;
}
 
Example #12
Source File: DialogsItemAnimator.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean animateAdd(final ViewHolder holder) {
    resetAnimation(holder);
    if (holder.itemView instanceof DialogCell) {
        ((DialogCell) holder.itemView).setClipProgress(1.0f);
    } else {
        holder.itemView.setAlpha(0);
    }
    mPendingAdditions.add(holder);
    return true;
}
 
Example #13
Source File: DialogsAdapter.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onViewAttachedToWindow(RecyclerView.ViewHolder holder) {
    if (holder.itemView instanceof DialogCell) {
        DialogCell dialogCell = (DialogCell) holder.itemView;
        dialogCell.onReorderStateChanged(isReordering, false);
        int position = fixPosition(holder.getAdapterPosition());
        dialogCell.setDialogIndex(position);
        dialogCell.checkCurrentDialogIndex(dialogsListFrozen);
        dialogCell.setChecked(selectedDialogs.contains(dialogCell.getDialogId()), false);
    }
}
 
Example #14
Source File: MessagesSearchAdapter.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
    if (holder.getItemViewType() == 0) {
        DialogCell cell = (DialogCell) holder.itemView;
        cell.useSeparator = true;
        MessageObject messageObject = (MessageObject) getItem(position);
        cell.setDialog(messageObject.getDialogId(), messageObject, messageObject.messageOwner.date, true);
    }
}
 
Example #15
Source File: ThemePreviewActivity.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int i) {
    if (viewHolder.getItemViewType() == 0) {
        DialogCell cell = (DialogCell) viewHolder.itemView;
        cell.useSeparator = (i != getItemCount() - 1);
        cell.setDialog(dialogs.get(i));
    }
}
 
Example #16
Source File: DialogsAdapter.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onViewAttachedToWindow(RecyclerView.ViewHolder holder)
{
    if (holder.itemView instanceof DialogCell)
    {
        ((DialogCell) holder.itemView).checkCurrentDialogIndex();
    }
}
 
Example #17
Source File: ThemePreviewActivity.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int i) {
    if (viewHolder.getItemViewType() == 0) {
        DialogCell cell = (DialogCell) viewHolder.itemView;
        cell.useSeparator = (i != getItemCount() - 1);
        cell.setDialog(dialogs.get(i));
    }
}
 
Example #18
Source File: DialogsAdapter.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onViewAttachedToWindow(RecyclerView.ViewHolder holder)
{
    if (holder.itemView instanceof DialogCell)
    {
        ((DialogCell) holder.itemView).checkCurrentDialogIndex();
    }
}
 
Example #19
Source File: AnimationProperties.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void setValue(DialogCell object, float value) {
    object.setClipProgress(value);
}
 
Example #20
Source File: AnimationProperties.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Float get(DialogCell object) {
    return object.getClipProgress();
}
 
Example #21
Source File: DialogsActivity.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
private void updateVisibleRows(int mask)
{
    if (listView == null)
        return;

    int count = listView.getChildCount();
    for (int a = 0; a < count; a++)
    {
        View child = listView.getChildAt(a);
        if (child instanceof DialogCell)
        {
            if (listView.getAdapter() != dialogsSearchAdapter)
            {
                DialogCell cell = (DialogCell) child;
                if ((mask & MessagesController.UPDATE_MASK_NEW_MESSAGE) != 0)
                {
                    cell.checkCurrentDialogIndex();
                    if (dialogsType == MessagesController.DialogType.All && AndroidUtilities.isTablet())
                    {
                        cell.setDialogSelected(cell.getDialogId() == openedDialogId);
                    }
                }
                else if ((mask & MessagesController.UPDATE_MASK_SELECT_DIALOG) != 0)
                {
                    if (dialogsType == MessagesController.DialogType.All && AndroidUtilities.isTablet())
                    {
                        cell.setDialogSelected(cell.getDialogId() == openedDialogId);
                    }
                }
                else
                {
                    cell.update(mask);
                }
            }
        }
        else if (child instanceof UserCell)
        {
            ((UserCell) child).update(mask);
        }
        else if (child instanceof ProfileSearchCell)
        {
            ((ProfileSearchCell) child).update(mask);
        }
        else if (child instanceof RecyclerListView)
        {
            RecyclerListView innerListView = (RecyclerListView) child;
            int count2 = innerListView.getChildCount();
            for (int b = 0; b < count2; b++)
            {
                View child2 = innerListView.getChildAt(b);
                if (child2 instanceof HintDialogCell)
                {
                    ((HintDialogCell) child2).checkUnreadCounter(mask);
                }
            }
        }
    }

    if (updateTabCounters)
    {
        updateTabsUnreadCount();
        updateTabCounters = false;
    }
}
 
Example #22
Source File: AnimationProperties.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void setValue(DialogCell object, float value) {
    object.setClipProgress(value);
}
 
Example #23
Source File: AnimationProperties.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Float get(DialogCell object) {
    return object.getClipProgress();
}
 
Example #24
Source File: DialogsActivity.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
private void updateVisibleRows(int mask)
{
    if (listView == null)
        return;

    int count = listView.getChildCount();
    for (int a = 0; a < count; a++)
    {
        View child = listView.getChildAt(a);
        if (child instanceof DialogCell)
        {
            if (listView.getAdapter() != dialogsSearchAdapter)
            {
                DialogCell cell = (DialogCell) child;
                if ((mask & MessagesController.UPDATE_MASK_NEW_MESSAGE) != 0)
                {
                    cell.checkCurrentDialogIndex();
                    if (dialogsType == MessagesController.DialogType.All && AndroidUtilities.isTablet())
                    {
                        cell.setDialogSelected(cell.getDialogId() == openedDialogId);
                    }
                }
                else if ((mask & MessagesController.UPDATE_MASK_SELECT_DIALOG) != 0)
                {
                    if (dialogsType == MessagesController.DialogType.All && AndroidUtilities.isTablet())
                    {
                        cell.setDialogSelected(cell.getDialogId() == openedDialogId);
                    }
                }
                else
                {
                    cell.update(mask);
                }
            }
        }
        else if (child instanceof UserCell)
        {
            ((UserCell) child).update(mask);
        }
        else if (child instanceof ProfileSearchCell)
        {
            ((ProfileSearchCell) child).update(mask);
        }
        else if (child instanceof RecyclerListView)
        {
            RecyclerListView innerListView = (RecyclerListView) child;
            int count2 = innerListView.getChildCount();
            for (int b = 0; b < count2; b++)
            {
                View child2 = innerListView.getChildAt(b);
                if (child2 instanceof HintDialogCell)
                {
                    ((HintDialogCell) child2).checkUnreadCounter(mask);
                }
            }
        }
    }

    if (updateTabCounters)
    {
        updateTabsUnreadCount();
        updateTabCounters = false;
    }
}