https://github.com/abdohurbly/abdalwahab
Upgrage
https://github.com/abdohurbly/abdalwahab
Last synced: 3 months ago
JSON representation
Upgrage
- Host: GitHub
- URL: https://github.com/abdohurbly/abdalwahab
- Owner: Abdohurbly
- License: apache-2.0
- Created: 2017-09-06T01:45:02.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2024-08-29T15:01:42.000Z (about 1 year ago)
- Last Synced: 2024-08-30T15:41:27.956Z (about 1 year ago)
- Language: Java
- Size: 225 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
[](https://jitpack.io/#Abdohurbly/AbdAlwahab)
# Fork Lib.
# Abdulwahab Herbli && Hisham Seddik (HyldenMan)
# Android Chat UIA chat UI library with different customization options. Currently it only has a title edit that can be used.
This is still under development, and more changes will gradually come which would include new features such as adding images and files.

### Version
v2.0.1### Installation
Add this to your build.gradle file's dependencies:
implementation 'com.github.Abdohurbly:AbdAlwahab:1.0.10'
## Usage
Drop the ChatView in your XML layout as is shown below:```
/>
```You need to add this attribute to your root layout.
```
xmlns:chatview="http://schemes.android.com/apk/res-auto"
```Currently there aren't many methods that can be utilized within Java code. However, the view can be customized from the XML file. You can still define it in your activity class as follows.
```
ChatView chatView = (ChatView) findViewById(R.id.chat_view);
```### Attributes
ChatView has the following attributes:
```
chatview:backgroundColor=""
chatview:inputBackgroundColor=""
chatview:inputUseEditorAction="" // true or false
chatview:inputTextAppearance=""
chatview:inputTextSize=""
chatview:inputTextColor=""
chatview:inputHintColor=""
chatview:inputHintText=""chatview:titleBackgroundColor=""
chatview:titleTextAppearance=""
chatview:titleTextSize=""
chatview:titleTextColor=""
chatview:titleHintColor=""
chatview:titleHintText=""chatview:sendBtnIcon=""
chatview:sendBtnIconTint=""
chatview:sendBtnBackgroundTint=""chatview:bubbleBackgroundRcv="" // color
chatview:bubbleBackgroundSend="" //color
chatview:bubbleElevation="" // "flat" or "elevated"```
### Sending messages
`OnSentMessageListener` is used to detect sending messages actions.
```
chatView.setOnSentMessageListener(new ChatView.OnSentMessageListener(){
@Override
public boolean sendMessage(ChatMessage chatMessage){
// perform actual message sending
return true;
}
});
```You can perform your connection in the `sendMessage(ChatMessage chatMessage)` method.
The returned value will determine whether the message is sent or not.
### Receiving messages
You can add received messages by using `chatView.addMessage(ChatMessage message)`, or, for multiple messages, `chatView.addMessages(ArrayList messages)`
Messages will appear to the right or the left depending on the `Type` variable in your `ChatMessage` object.
### Deleting messages
You can remove messages using `chatView.removeMessage(int position)` or `chatView.clearMessages()`
### The ChatMessage interface
Your app should implement this interface to define its own implementation of a `Message` model. Your implementation should typically contain a variable for each getter method.
There is an `InternalMessage` class that implements this interface, but it is strongly recommended for you to define your own implementation, as using `InternalMessage` class might cause (at least) complexities in your code.
The interface also contains the Type enum which only contains two values: `SENT`, and `RECEIVED`. I'll leave you to figure out what each means ;) .
### Typing Listener
This listener is used to perform an action during different typing states.
```
chatView.setTypingListener(new ChatView.TypingListener(){
@Override
public void userStartedTyping(){
// will be called when the user starts typing
}
@Override
public void userStoppedTyping(){
// will be called when the user stops typing
}
});
```