therealbluepandabear
02/10/2022, 1:25 AMobject StringConstants {
object DialogStrings {
const val DIALOG_POSITIVE_BUTTON_TEXT = "OK"
const val DIALOG_NEGATIVE_BUTTON_TEXT = "Cancel"
const val DIALOG_EXCEPTION_INFO_TITLE = "Exception Info"
const val DIALOG_VIEW_FILE_ERROR_TITLE = "Error trying to view file"
const val DIALOG_CLEAR_CANVAS_TITLE = "Clear canvas"
const val DIALOG_CLEAR_CANVAS_MESSAGE = "Are you sure you want to clear the canvas?"
const val DIALOG_UNSAVED_CHANGES_TITLE = "Unsaved changes"
const val DIALOG_UNSAVED_CHANGES_MESSAGE = "You have unsaved changes, are you sure you want to exit?"
}
object FragmentStrings {
const val FRAGMENT_FIND_AND_REPLACE_TITLE = "Find and Replace"
const val FRAGMENT_COLOR_PICKER_TITLE = "Select Color"
const val FRAGMENT_NEW_COLOR_PALETTE_TITLE = "New Color Palette"
}
}
ephemient
02/10/2022, 3:08 AMFleshgrinder
02/10/2022, 8:09 AMobject
is a singleton and not a purely static class, the moment you add a function or whatever initialization code is added. Simply adding things to files without any wrapping structure is going to create proper fully static things. I remember namespacing of symbols to be a future feature for Kotlin, not sure what the state is there.Matteo Mirk
02/10/2022, 10:33 AMIf a file contains multiple classes, or only top-level declarations, choose a name describing what the file contains, and name the file accordingly.https://kotlinlang.org/docs/coding-conventions.html#source-file-names
Placing multiple declarations (classes, top-level functions or properties) in the same Kotlin source file is encouraged as long as these declarations are closely related to each other semanticallyhttps://kotlinlang.org/docs/coding-conventions.html#source-file-organization But really, like epheminent said this solution is going to work for a prototype, not for a product that needs localization, which is handled differently, involving properties files.
Fleshgrinder
02/10/2022, 5:32 PMMatteo Mirk
02/11/2022, 10:33 AMFleshgrinder
02/11/2022, 10:37 AMobject
singleton initialization, as well as adding extensions to anything, regardless of whether it has a companion object or not (incl. Java classes). This should also improve discoverability once implemented in IntelliJ because we are not looking at an endless amount of global symbols anymore, but can scope them to other symbols. 😎