This plan outlines the changes made to implement the Settings Screen enhancements, specifically focusing on .radare2rc editing, custom font support, language switching, and project directory management.
- File:
app/src/main/java/top/wsdx233/r2droid/data/SettingsManager.kt - Changes:
- Added
getR2rcFile,getR2rcContent,setR2rcContentto manage.radare2rccontent directly infilesDir/radare2/bin/.radare2rc. - Added
getCustomFont()method to loadFontFamilyfrom the selected font file path. - Updated property setters to use correct Kotlin syntax (
set(value) { ... }). - Added
projectHomeproperty for custom project directory.
- Added
- File:
app/src/main/java/top/wsdx233/r2droid/screen/settings/SettingsScreen.kt - Changes:
- Implemented
SettingsViewModelto bridge UI andSettingsManager. - Added
AlertDialogfor editing.radare2rccontent directly. - Added UI for selecting Project Home and Font file using system file pickers.
- Added Language selection dialog.
- Implemented
- File:
app/src/main/java/top/wsdx233/r2droid/activity/MainActivity.kt - Changes:
- Overrode
attachBaseContextto apply language settings before Context creation. - Wrapped
MainAppContentwithCompositionLocalProviderto provideLocalAppFontwith the custom font loaded from settings. - Initialized
SettingsManagerinonCreate.
- Overrode
- File:
app/src/main/java/top/wsdx233/r2droid/ui/theme/Type.kt- Defined
LocalAppFontcomposition local.
- Defined
- Files:
ProjectViewers.kt,ProjectComponents.kt- Replaced all usages of
FontFamily.MonospacewithLocalAppFont.currentto ensure the custom font is used in Hex, Disassembly, Decompiler views, and various project components.
- Replaced all usages of
- File:
app/src/main/java/top/wsdx233/r2droid/screen/home/HomeViewModel.kt- Updated
copyContentUriToCacheto use the custom project home directory if set.
- Updated
- File:
app/src/main/java/top/wsdx233/r2droid/util/R2Runtime.kt- Verified the direct-launch environment sets
HOME=filesDir/radare2/bin, ensuringradare2loads the custom.radare2rcfile.
- Verified the direct-launch environment sets
- .radare2rc: Creating/editing via Settings -> applied to
filesDir/radare2/bin/.radare2rc-> loaded by r2pipe (viaHOMEenv var). - Font: Selected via Settings -> applied via
LocalAppFont-> visible in all viewers. - Language: Selected via Settings -> applied via
attachBaseContext-> visible on app restart (or activity recreation). - Project Dir: Selected via Settings -> used for new projects.
- User might need to restart the app for Language settings to take full effect (Activity recreation handles most, but
attachBaseContextrequires fresh context usually). - Verify permissions for external project directories if chosen (Android scoped storage limits might require specific handling if user picks a restricted folder). Currently using generic
OpenDocumentTree.