org.telegram.ui.Cells.HintDialogCell Java Examples

The following examples show how to use org.telegram.ui.Cells.HintDialogCell. 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: DialogsSearchAdapter.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType)
{
    View view = new HintDialogCell(mContext);
    view.setLayoutParams(new RecyclerView.LayoutParams(AndroidUtilities.dp(80), AndroidUtilities.dp(100)));
    return new RecyclerListView.Holder(view);
}
 
Example #2
Source File: DialogsSearchAdapter.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position)
{
    HintDialogCell cell = (HintDialogCell) holder.itemView;

    TLRPC.TL_topPeer peer = DataQuery.getInstance(currentAccount).hints.get(position);
    TLRPC.TL_dialog dialog = new TLRPC.TL_dialog();
    TLRPC.Chat chat = null;
    TLRPC.User user = null;
    int did = 0;
    if (peer.peer.user_id != 0)
    {
        did = peer.peer.user_id;
        user = MessagesController.getInstance(currentAccount).getUser(peer.peer.user_id);
    }
    else if (peer.peer.channel_id != 0)
    {
        did = -peer.peer.channel_id;
        chat = MessagesController.getInstance(currentAccount).getChat(peer.peer.channel_id);
    }
    else if (peer.peer.chat_id != 0)
    {
        did = -peer.peer.chat_id;
        chat = MessagesController.getInstance(currentAccount).getChat(peer.peer.chat_id);
    }
    cell.setTag(did);
    String name = "";
    if (user != null)
    {
        name = ContactsController.formatName(user.first_name, user.last_name);
    }
    else if (chat != null)
    {
        name = chat.title;
    }
    cell.setDialog(did, true, name);
}
 
Example #3
Source File: DialogsSearchAdapter.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType)
{
    View view = new HintDialogCell(mContext);
    view.setLayoutParams(new RecyclerView.LayoutParams(AndroidUtilities.dp(80), AndroidUtilities.dp(100)));
    return new RecyclerListView.Holder(view);
}
 
Example #4
Source File: DialogsSearchAdapter.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position)
{
    HintDialogCell cell = (HintDialogCell) holder.itemView;

    TLRPC.TL_topPeer peer = DataQuery.getInstance(currentAccount).hints.get(position);
    TLRPC.TL_dialog dialog = new TLRPC.TL_dialog();
    TLRPC.Chat chat = null;
    TLRPC.User user = null;
    int did = 0;
    if (peer.peer.user_id != 0)
    {
        did = peer.peer.user_id;
        user = MessagesController.getInstance(currentAccount).getUser(peer.peer.user_id);
    }
    else if (peer.peer.channel_id != 0)
    {
        did = -peer.peer.channel_id;
        chat = MessagesController.getInstance(currentAccount).getChat(peer.peer.channel_id);
    }
    else if (peer.peer.chat_id != 0)
    {
        did = -peer.peer.chat_id;
        chat = MessagesController.getInstance(currentAccount).getChat(peer.peer.chat_id);
    }
    cell.setTag(did);
    String name = "";
    if (user != null)
    {
        name = ContactsController.formatName(user.first_name, user.last_name);
    }
    else if (chat != null)
    {
        name = chat.title;
    }
    cell.setDialog(did, true, name);
}
 
Example #5
Source File: DialogsSearchAdapter.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) {
    HintDialogCell cell = (HintDialogCell) holder.itemView;

    TLRPC.TL_topPeer peer = MediaDataController.getInstance(currentAccount).hints.get(position);
    TLRPC.Dialog dialog = new TLRPC.TL_dialog();
    TLRPC.Chat chat = null;
    TLRPC.User user = null;
    int did = 0;
    if (peer.peer.user_id != 0) {
        did = peer.peer.user_id;
        user = MessagesController.getInstance(currentAccount).getUser(peer.peer.user_id);
    } else if (peer.peer.channel_id != 0) {
        did = -peer.peer.channel_id;
        chat = MessagesController.getInstance(currentAccount).getChat(peer.peer.channel_id);
    } else if (peer.peer.chat_id != 0) {
        did = -peer.peer.chat_id;
        chat = MessagesController.getInstance(currentAccount).getChat(peer.peer.chat_id);
    }
    cell.setTag(did);
    String name = "";
    if (user != null) {
        name = UserObject.getFirstName(user);
    } else if (chat != null) {
        name = chat.title;
    }
    cell.setDialog(did, true, name);
}
 
Example #6
Source File: DialogsSearchAdapter.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) {
    HintDialogCell cell = (HintDialogCell) holder.itemView;

    TLRPC.TL_topPeer peer = MediaDataController.getInstance(currentAccount).hints.get(position);
    TLRPC.Dialog dialog = new TLRPC.TL_dialog();
    TLRPC.Chat chat = null;
    TLRPC.User user = null;
    int did = 0;
    if (peer.peer.user_id != 0) {
        did = peer.peer.user_id;
        user = MessagesController.getInstance(currentAccount).getUser(peer.peer.user_id);
    } else if (peer.peer.channel_id != 0) {
        did = -peer.peer.channel_id;
        chat = MessagesController.getInstance(currentAccount).getChat(peer.peer.channel_id);
    } else if (peer.peer.chat_id != 0) {
        did = -peer.peer.chat_id;
        chat = MessagesController.getInstance(currentAccount).getChat(peer.peer.chat_id);
    }
    cell.setTag(did);
    String name = "";
    if (user != null) {
        name = UserObject.getFirstName(user);
    } else if (chat != null) {
        name = chat.title;
    }
    cell.setDialog(did, true, name);
}
 
Example #7
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 #8
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 #9
Source File: DialogsSearchAdapter.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View view = new HintDialogCell(mContext);
    view.setLayoutParams(new RecyclerView.LayoutParams(AndroidUtilities.dp(80), AndroidUtilities.dp(86)));
    return new RecyclerListView.Holder(view);
}
 
Example #10
Source File: DialogsSearchAdapter.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View view = new HintDialogCell(mContext);
    view.setLayoutParams(new RecyclerView.LayoutParams(AndroidUtilities.dp(80), AndroidUtilities.dp(86)));
    return new RecyclerListView.Holder(view);
}