Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/iambhargavnath/messenger-library
This is a simple to implement Android Messenger UI.
https://github.com/iambhargavnath/messenger-library
android android-library kotlin material-design messenger
Last synced: about 2 months ago
JSON representation
This is a simple to implement Android Messenger UI.
- Host: GitHub
- URL: https://github.com/iambhargavnath/messenger-library
- Owner: iambhargavnath
- Created: 2024-11-13T06:30:08.000Z (about 2 months ago)
- Default Branch: master
- Last Pushed: 2024-11-13T07:29:44.000Z (about 2 months ago)
- Last Synced: 2024-11-13T07:34:04.290Z (about 2 months ago)
- Topics: android, android-library, kotlin, material-design, messenger
- Language: Kotlin
- Homepage:
- Size: 1.38 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Messenger Library
This is a simple to implement Android Messenger UI.## Screenshots
## Installation
### Installation for Groovy DSL
1. Add the following dependency in your project's `build.gradle` file:
```
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
```2. Add the following dependency in your app's `build.gradle` file:
```
dependencies {
implementation 'com.github.iambhargavnath:messenger-library:v1.0.0'
}
```### Installation for Kotlin DSL
1. Add the following dependency in your project's `settings.gradle.kts` file:
```kotlin
dependencyResolutionManagement {
...
repositories {
...
mavenCentral()
maven(url = "https://jitpack.io")
}
}
```2. Add the following dependency in your app's `build.gradle.kts` file:
```kotlin
dependencies {
implementation("com.github.iambhargavnath:messenger-library:v1.0.0")
}
```## How to use
### 1. Create a layout with a RecyclerView
```Example code in XML```
### 2. Create a Message List
```Example code in Kotlin
import com.iambhargavnath.messengerlibrary.model.Message
...
val messageList = listOf(
Message(sender = "other", content = "Hi", time = "2024-11-12 10:15:00", profilePicUrl = "https://masterpiecer-images.s3.yandex.net/a7a8505187f411eeb3fc5696910b1137:upscaled"),
Message(sender = "me", content = "Hey! How's it going?", time = "2024-11-12 10:15:30"),
Message(sender = "other", content = "Pretty good, thanks! Just finished work.", time = "2024-11-12 10:16:00", profilePicUrl = "https://masterpiecer-images.s3.yandex.net/a7a8505187f411eeb3fc5696910b1137:upscaled"),
Message(sender = "other", content = "It was a long day, but I got a lot done.", time = "2024-11-12 10:16:15", profilePicUrl = "https://masterpiecer-images.s3.yandex.net/a7a8505187f411eeb3fc5696910b1137:upscaled"),
Message(sender = "me", content = "Nice! Busy days can be satisfying.", time = "2024-11-12 10:16:30")
)
```
Here `time` and `profilePicUrl` is nullable.Or you can retrieve messages from server and add to the `messageList`
```
val messageList: List = retrievedMessagesFromServer
```### 3. Add the Message List to MessageAdapter
```Example Code in Kotlin
import com.iambhargavnath.messengerlibrary.adapter.MessageAdapter
...
val yourUserId = "me" // Replace 'me' with your username.
val messageAdapter = MessageAdapter(messageList = messageList, yourUserId = yourUserId)
```### 4. Add the MessageAdapter to the RecyclerView
```Example Code in Kotlin
val recyclerView : RecyclerView = findViewById(R.id.recyclerView)
recyclerView.layoutManager = LinearLayoutManager(this)
recyclerView.adapter = messageAdapter
```### 5. Add internet permission to download profile image from internet
```Example Code in AndroidManifest.xml```
### Developed by Bhargav Nath
## Find me at