Migrate to Jetpack Compose and modernize Android stack#1
Open
Migrate to Jetpack Compose and modernize Android stack#1
Conversation
…up dependencies Bug fixes: - Fix NPE in Projects.listDirs() and WorkingProject.listFilesInDir() when listFiles() returns null (directory doesn't exist or isn't readable) - Fix swapped parameters in FileSystem.saveFile() where directory and filename were reversed in the File constructor - Fix RxJava subscribeOn/observeOn being swapped in ChooseProject Presenter (subscribeOn should be io, observeOn should be mainThread) - Add missing onComplete() call in Projects.listDirs() Observable - Fix deleteFile() calling deleteFileWarning() after deletion already started Architecture improvements: - Decouple ViewHolder from Presenter contracts - adapters now bind data themselves using data-returning methods instead of passing ViewHolders to the presenter - Rename contract interfaces: UserActions -> PresenterContract for consistency - Extract dialog creation into dedicated methods in Activities - Improve MVP separation of concerns Code quality: - Use try-with-resources for all IO operations in FileSystem (fixes resource leaks) - Replace empty catch blocks with proper Log.e() error logging - Make singleton pattern thread-safe with double-checked locking and volatile - Add private constructors to singleton classes - Use File.separator and File constructor for path building instead of string concatenation - Improve variable naming (model1 -> workingProjectModel, subscribe -> loadProjectsDisposable, etc.) - Add proper null-safety checks throughout - Reset codeChangedSinceLastSave on file open and successful save - Clear editor when currently-open file is deleted - Remove unused Dagger 2 dependency (was declared but never used) - Organize build.gradle dependencies into logical groups - Fix CachingFactory naming conventions (FontMap -> fontCache) - Update app name from placeholder to Coding Hive IDE https://claude.ai/code/session_011ivzksCxix6VawrbeBoUgK
…h Coroutines Complete rewrite from MVP/Java/XML/RxJava to MVI/Kotlin/Compose/Coroutines: Architecture (MVI): - State: Immutable data classes representing entire screen state - Intent: Sealed interfaces for all user actions - Effect: One-shot side effects (navigation, toasts) via Channel - ViewModel: Processes intents, updates StateFlow, emits effects Build system: - Upgrade Gradle 4.4 -> 8.2, AGP 3.1.4 -> 8.1.2 - Add Kotlin 1.9.0 with Compose compiler 1.5.1 - Add Compose BOM 2023.10.01 with Material3 - Add Navigation Compose, ViewModel Compose - Add Kotlinx Coroutines - Remove RxJava, RxAndroid, RxBinding - Remove Dagger 2 (was unused) - Remove SyntaxView XML library (replaced by Compose TextField) - Remove Android Support libraries (migrated to AndroidX) - Update compileSdk/targetSdk 28 -> 34 New file structure: - data/FileSystem.kt - File I/O with suspend functions - data/ProjectRepository.kt - Repository pattern over file system - ui/projects/ - Projects screen (State, Intent, ViewModel, Screen) - ui/editor/ - Editor screen (State, Intent, ViewModel, Screen) - ui/theme/ - Material3 dark theme matching original design - MainActivity.kt - Single activity with Compose - CodingHiveApp.kt - Navigation host Removed: - All 13 Java files (MVP presenters, contracts, adapters, models) - All 5 XML layout files (replaced by Compose) - CodingTextView/CachingFactory (font handled by Compose FontFamily) - FiraCode font moved from assets/ to res/font/ for Compose access https://claude.ai/code/session_011ivzksCxix6VawrbeBoUgK
…ity, add Koin DI - Move all hardcoded strings to strings.xml with proper resource IDs - Update effects to use @stringres Int instead of raw strings - Separate Screen(vm) from ScreenContent(state, onIntent) in both screens - Add Koin dependency injection: AppModule, CodingHiveApplication, koinViewModel() - Remove default constructor parameters to let Koin handle wiring https://claude.ai/code/session_011ivzksCxix6VawrbeBoUgK
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR modernizes the CodingHive project by migrating from the legacy Android Support Library to AndroidX, upgrading to Jetpack Compose for the UI layer, and replacing RxJava with Kotlin Coroutines. The project now targets Android 14 (API 34) with Java 17 compatibility.
Key Changes
Build Configuration
Dependencies
Architecture & Code
UI Layer
Data Layer
Notable Implementation Details
https://claude.ai/code/session_011ivzksCxix6VawrbeBoUgK