This project demonstrates modern Android development using MVVM architecture pattern with Kotlin, migrated from the original MVP Java implementation.
- MVVM Architecture: Model-View-ViewModel pattern with Repository pattern
- Language: 100% Kotlin
- Minimum SDK: 24 (Android 7.0)
- Target SDK: 34 (Android 14)
- Kotlin: Primary programming language
- Coroutines: For asynchronous programming
- Flow: For reactive programming
- Hilt: Dependency injection
- ViewBinding: Type-safe view references
- ViewModel: UI-related data holder with lifecycle awareness
- LiveData & StateFlow: Observable data holder classes
- Room: Database abstraction layer
- Repository Pattern: Single source of truth for data
- Retrofit: HTTP client for API calls
- OkHttp: HTTP & HTTP/2 client
- Moshi: JSON library for Kotlin
- Material Design Components: Modern UI components
- RecyclerView: List implementation with ListAdapter
- ViewPager2: Modern paging implementation
- Navigation Component: App navigation
- JUnit: Unit testing framework
- Espresso: UI testing framework
- Mockito: Mocking framework
- Gradle Version Catalogs: Centralized dependency management
- Kotlin DSL: Modern build script syntax
app/
βββ src/main/kotlin/com/mindorks/framework/mvvm/
β βββ data/
β β βββ local/
β β β βββ database/ # Room database implementation
β β β βββ prefs/ # SharedPreferences wrapper
β β βββ network/ # API interfaces and implementations
β β βββ repository/ # Data repository implementations
β β βββ model/ # Data models
β βββ ui/
β β βββ base/ # Base classes for Activities/Fragments/ViewModels
β β βββ main/ # Main screen with question cards
β β βββ login/ # Login functionality
β β βββ splash/ # Splash screen
β β βββ feed/ # Feed screens (blogs/open source)
β βββ utils/ # Utility classes
β βββ MvvmApp.kt # Application class
βββ src/debug/ # Debug-only code (Flipper, database inspection)
βββ src/test/ # Unit tests
- Kotlin Coroutines: Replaces RxJava for simpler async code
- Room Database: Replaces GreenDAO with better Kotlin support
- Modern Networking: Retrofit + Coroutines for API calls
- Type Safety: Leverages Kotlin's type system for safer code
- β AndroidNetworking β Retrofit + OkHttp
- β Calligraphy β Native Font Resources
- β PlaceHolderView β RecyclerView + ListAdapter
- β Debug-DB β Flipper (debug builds)
- β RxJava β Kotlin Coroutines + Flow
- Swipe Cards: Custom swipe implementation for question cards
- Modern Adapters: ListAdapter with DiffUtil for efficient updates
- Network Error Handling: Comprehensive error handling with sealed classes
- Debug Tools: Flipper integration for debugging (debug builds only)
- Android Studio Arctic Fox or later
- JDK 17 or later
- Android SDK 34
- Clone the repository
git clone https://github.com/your-username/android-mvvm-architecture.git-
Open the project in Android Studio
-
Sync project with Gradle files
-
Run the app
The project uses Gradle Version Catalogs for dependency management. All dependencies are defined in gradle/libs.versions.toml.
./gradlew test./gradlew connectedAndroidTestDebug builds include additional tools:
- Flipper: Network and database inspection
- LeakCanary: Memory leak detection
- Debug Activity: Database inspection and export
In debug builds, you can access debug tools through the navigation drawer or by directly starting the DebugActivity.
This project was migrated from MVP (Java) to MVVM (Kotlin). Key migration points:
- Presenters β ViewModels
- View Interfaces β LiveData/StateFlow observers
- Manual lifecycle management β Automatic lifecycle awareness
- Java β Kotlin
- RxJava β Coroutines + Flow
- GreenDAO β Room
- Legacy networking β Modern Retrofit
- Type safety with Kotlin
- Null safety
- Coroutines for cleaner async code
- Modern Android Architecture Components
- Android Architecture Components
- Kotlin Coroutines Guide
- Room Database Guide
- Hilt Dependency Injection
Copyright (C) 2017 MINDORKS NEXTGEN PRIVATE LIMITED
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://mindorks.com/license/apache-v2
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
For questions and support, please visit:
Happy Coding! π