Welcome to NewsApp, a sleek and efficient Android application built using Kotlin. With NewsApp, you can stay updated with the latest news worldwide, thanks to its seamless integration with the NewsAPI 📰✨.
- 🌍 Browse Global News: Stay informed with the latest headlines from around the world.
- 🔍 Search Functionality: Quickly find news articles with an optimized search feature.
- 📁 Offline Access: Save articles to read later, even without internet.
- 🧑💻 Built with Kotlin: Leveraging modern and robust technology for a smooth experience.
Here's a quick look at the main components of the application:
- ArticleAdapter: Bridges the RecyclerView and your news data, providing a polished UI for articles.
- NewsAPI: Interface containing endpoints to fetch news.
- RetrofitInstance: Configures Retrofit with the base URL and converter factory.
- ArticleDao: Manages database operations for saved articles.
- ArticleDatabase: Handles database creation and versioning using Room.
- Converters: Helps store complex data types in the database.
- Classes like
Article
,Source
, andNewsResponse
model the data structure fetched from the NewsAPI.
- Manages data flow between the local database and remote API, ensuring efficiency and reliability.
- Activities & Fragments:
MainActivity
: Hosts the app's core navigation.ArticleFragment
: Displays detailed news articles.BreakingNewsFragment
: Showcases the latest news.SavedNewsFragment
: Lists all saved articles.SearchNewsFragment
: Enables keyword-based searches.
- Constants: Houses key app configurations like API key and base URL.
- Resource: A sealed class to represent different states (loading, success, error) during API calls.
- Kotlin 1.5+
- Android Studio Bumblebee+
- A valid API key from NewsAPI.
-
Clone this repository:
git clone https://github.com/yourusername/NewsApp.git```
-
Open the project in Android Studio.
-
Add your NewsAPI key to Constants.kt:
const val API_KEY = "your_api_key_here"
- Build and run the app on an emulator or physical device.
- Contributions are always welcome! Feel free to fork this repo, make your changes, and submit a pull request.
- This project is licensed under the MIT License.
- NewsAPI for providing reliable news data.
- Android and Kotlin communities for their invaluable resources.