Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/js-bhavyansh/learning_quotes
Creating a quotes app for learning purposes without using any external API and MVVM architecture. Focused on demonstrating how to display items in a LazyColumn and access data from a JSON file within the project.
https://github.com/js-bhavyansh/learning_quotes
Last synced: 2 days ago
JSON representation
Creating a quotes app for learning purposes without using any external API and MVVM architecture. Focused on demonstrating how to display items in a LazyColumn and access data from a JSON file within the project.
- Host: GitHub
- URL: https://github.com/js-bhavyansh/learning_quotes
- Owner: js-bhavyansh
- Created: 2024-05-31T12:42:24.000Z (6 months ago)
- Default Branch: master
- Last Pushed: 2024-05-31T13:50:15.000Z (6 months ago)
- Last Synced: 2024-10-21T10:02:04.379Z (about 1 month ago)
- Language: Kotlin
- Homepage:
- Size: 111 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Quotes App
This project is a quotes app developed for learning purposes, focusing on demonstrating how to display items in a LazyColumn and access data from a JSON file within the project. The app does not rely on any external API.
## Description
The Quotes App is designed to showcase the implementation of displaying quotes fetched from a locally stored JSON file. It emphasizes the MVVM architecture pattern and demonstrates loading data from the JSON file directly within the app.
## Features
- **Display Quotes**: Quotes are displayed in a user-friendly format using LazyColumn.
- **Local Data Access**: Quotes are loaded from a JSON file stored within the project.## Screenshots
## Usage
1. Clone the repository:
```bash
git clone https://github.com/Bhavyansh03-tech/Learning_Quotes.git
```
2. Open the project in your preferred IDE.
3. Run the app on an Android emulator or device.## Implementation Details
To load quotes from the JSON file, the following function is used:
```kotlin
fun loadAssetsFromFile(context: Context){
val inputStream = context.assets.open("quotes.json")
val size: Int = inputStream.available()
val buffer = ByteArray(size)
inputStream.read(buffer)
inputStream.close()
val json = String(buffer, Charsets.UTF_8)
val gson = Gson()
data = gson.fromJson(json, Array::class.java)
isDataLoaded.value = true
}
```## Contributing
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
1.> Fork the Project.\
2.> Create your Feature Branch `git checkout -b feature/AmazingFeature`.\
3.> Commit your Changes `git commit -m 'Add some AmazingFeature'`.\
4.> Push to the Branch `git push origin feature/AmazingFeature`.\
5.> Open a Pull Request## Acknowledgements
- Inspiration from various Android development tutorials and documentation.
## ContactFor questions or feedback, please contact [@Bhavyansh03-tech](https://github.com/Bhavyansh03-tech).