Add theme persistence and comprehensive Android design guidelines
This commit adds persistent theme storage and comprehensive documentation for Android development. Theme Persistence: - Created ThemeStorage with platform-specific implementations (SharedPreferences/UserDefaults) - Updated ThemeManager.initialize() to load saved theme on app start - Integrated ThemeStorage initialization in MainActivity and MainViewController - Theme selection now persists across app restarts Documentation (CLAUDE.md): - Added comprehensive Android Design System section - Documented all 11 themes and theme management - Provided color system guidelines (use MaterialTheme.colorScheme) - Documented spacing system (AppSpacing/AppRadius constants) - Added standard component usage examples (StandardCard, FormTextField, etc.) - Included screen patterns (Scaffold, pull-to-refresh, lists) - Provided button and dialog patterns - Listed key design principles for Android development Build Status: - ✅ Android builds successfully - ✅ iOS builds successfully - ✅ Theme persistence works on both platforms 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -5,6 +5,9 @@ import com.example.mycrib.storage.TokenManager
|
||||
import com.example.mycrib.storage.TokenStorage
|
||||
import com.example.mycrib.storage.TaskCacheManager
|
||||
import com.example.mycrib.storage.TaskCacheStorage
|
||||
import com.example.mycrib.storage.ThemeStorage
|
||||
import com.example.mycrib.storage.ThemeStorageManager
|
||||
import com.example.mycrib.ui.theme.ThemeManager
|
||||
|
||||
fun MainViewController() = ComposeUIViewController {
|
||||
// Initialize TokenStorage with iOS TokenManager
|
||||
@@ -13,5 +16,9 @@ fun MainViewController() = ComposeUIViewController {
|
||||
// Initialize TaskCacheStorage for offline task caching
|
||||
TaskCacheStorage.initialize(TaskCacheManager.getInstance())
|
||||
|
||||
// Initialize ThemeStorage and ThemeManager
|
||||
ThemeStorage.initialize(ThemeStorageManager.getInstance())
|
||||
ThemeManager.initialize()
|
||||
|
||||
App()
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.example.mycrib.storage
|
||||
|
||||
import platform.Foundation.NSUserDefaults
|
||||
|
||||
/**
|
||||
* iOS implementation of theme storage using NSUserDefaults.
|
||||
*/
|
||||
actual class ThemeStorageManager {
|
||||
private val defaults = NSUserDefaults.standardUserDefaults
|
||||
|
||||
actual fun saveThemeId(themeId: String) {
|
||||
defaults.setObject(themeId, forKey = KEY_THEME_ID)
|
||||
defaults.synchronize()
|
||||
}
|
||||
|
||||
actual fun getThemeId(): String? {
|
||||
return defaults.stringForKey(KEY_THEME_ID)
|
||||
}
|
||||
|
||||
actual fun clearThemeId() {
|
||||
defaults.removeObjectForKey(KEY_THEME_ID)
|
||||
defaults.synchronize()
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val KEY_THEME_ID = "theme_id"
|
||||
|
||||
private val instance by lazy { ThemeStorageManager() }
|
||||
|
||||
fun getInstance(): ThemeStorageManager = instance
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user