Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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.

Awesome Lists containing this project

README

        

# Messenger Library
This is a simple to implement Android Messenger UI.

## Screenshots


Screenshot1
Screenshot2



Screenshot3
Screenshot4

## 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


iambhargavnath
iambhargavnath
iambhargavnath
iambhargavnath