Skip to content

Add typing indicator support in ChatView#51

Open
subhan9090 wants to merge 8 commits intotimigod:masterfrom
subhan9090:typing-indicator
Open

Add typing indicator support in ChatView#51
subhan9090 wants to merge 8 commits intotimigod:masterfrom
subhan9090:typing-indicator

Conversation

@subhan9090
Copy link

This PR adds support for displaying a typing indicator in the ChatView when other users are typing. Key changes include:

Changes made:

ChatViewListAdapter

Added TYPING message type support.

Implemented addTypingIndicator(String sender) and removeTypingIndicator(String sender) methods for safely adding/removing typing indicators.

Ensured all list modifications and notifyDataSetChanged() calls occur on the UI thread using ListView.post().

Fixed getViewTypeCount() to return 3 (SENT, RECEIVED, TYPING), preventing ArrayIndexOutOfBoundsException.

ChatView

Added showTypingIndicator(String sender) and hideTypingIndicator(String sender) methods as a clean interface to manage typing indicators.

Supports multiple users typing concurrently without crashing.

Maintains existing message functionality intact.

Benefits:

Typing indicators now appear and disappear safely for each sender.

Fully compatible with existing messages.

Eliminates ArrayIndexOutOfBoundsException caused by incorrect view type count.

Usage:

chatView.showTypingIndicator("Alice");
chatView.hideTypingIndicator("Alice");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants