How devanshu07/news-app works
Main Components
• UI Layer: This includes Activities, Layouts, Adapters, and Click Listeners.
• For example, MainActivity (in activities directory) forms the primary entry point.
• XML layout files in the res/layout directory are used to design the UI.
• ViewModel Layer: The viewmodel (e.g., MainViewModel) connects the UI to the business logic.
• Data & Network Layer: Consists of:
• REST Client – ApiClient and RestInterface handle interaction with the external News API.
• Model Classes – such as News and TotalNews that define the data structure.
• Utility Components: Helpers and utilities found in the utils package (e.g., LocaleHelper, Util, and the specialized Glide SSL support classes).
• Testing Components: Unit tests and instrumentation tests found under app/src/test and app/src/androidTest.
Relationships and Interactions
• The UI Layer (MainActivity, Adapters, Click Listeners) communicates with the ViewModel for data.
• The ViewModel then makes asynchronous calls using the REST API (via ApiClient/RestInterface) to fetch news data.
• Received data (modeled via News/TotalNews) is then observed by the UI, triggering a view update.
• Utilities support various functions such as localization (LocaleHelper) and image loading (Glide with custom configurations).
Important Architectural Patterns
• MVVM Pattern: Separate the presentation layer (Activities/Fragments), ViewModel logic, and data/network components.
• Use of Retrofit and OkHttp for clean network interaction.
• Incorporation of dependency injection patterns might be implicit via how the third-party libraries and utilities are wired into the application.
• Modular separation by placing resources, business logic, and test cases in distinct directories to maintain a clean architecture.
Incorporate Relevant Technologies and Frameworks
• Android Studio as the IDE.
• Gradle as the build system, with specific Gradle configurations and third-party dependency management.
• Third-party libraries: Retrofit for API calls, Glide for image processing, ButterKnife for view binding, and Gson for JSON conversion.