diff --git a/app/src/main/java/be/re/writand/screens/WUIGlobals.kt b/app/src/main/java/be/re/writand/screens/WUIGlobals.kt index c5d8de1..7a2179c 100644 --- a/app/src/main/java/be/re/writand/screens/WUIGlobals.kt +++ b/app/src/main/java/be/re/writand/screens/WUIGlobals.kt @@ -1,18 +1,19 @@ package be.re.writand.screens import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.sp object WUIGlobals { /** * Standard value to be added to the font size setting. */ - val heading = 11.dp + const val HEADING = 11 /** * Standard title size to be added to the font size setting. */ - val title = 16.dp + const val TITLE = 16 /** * Standard corner radius for borders. diff --git a/app/src/main/java/be/re/writand/screens/components/WLoadingIndicator.kt b/app/src/main/java/be/re/writand/screens/components/WLoadingIndicator.kt index 9f2ded5..13d8b0b 100644 --- a/app/src/main/java/be/re/writand/screens/components/WLoadingIndicator.kt +++ b/app/src/main/java/be/re/writand/screens/components/WLoadingIndicator.kt @@ -27,7 +27,10 @@ fun WLoadingIndicator() { verticalArrangement = Arrangement.Center, horizontalAlignment = Alignment.CenterHorizontally ) { - CircularProgressIndicator(modifier = Modifier.padding(vertical = 10.dp), color = MaterialTheme.colorScheme.tertiary) + CircularProgressIndicator( + modifier = Modifier.padding(vertical = 10.dp), + color = MaterialTheme.colorScheme.tertiary + ) WText(text = "while( !( succeed = try() ) );", textAlign = TextAlign.Center) } diff --git a/app/src/main/java/be/re/writand/screens/components/WText.kt b/app/src/main/java/be/re/writand/screens/components/WText.kt index f8b69f0..35a058b 100644 --- a/app/src/main/java/be/re/writand/screens/components/WText.kt +++ b/app/src/main/java/be/re/writand/screens/components/WText.kt @@ -24,6 +24,10 @@ import be.re.writand.screens.SettingsViewModel /** * Composable to use UserSettings in the standard compose.material3.Text, * all parameters are explained in there, but the [settingsViewModel]. + * @param[settingsFontSizeAlterBy] when the UserSettings-fontSize is used, it can be altered + * relatively to it, if the WText-fontSize is not set. + * E.g. UserSettings-fontSize is 14, and settingsFontSizeAlterBy is set to 6, than + * the used fontSize will be 20.sp for the [Text] fontSize parameter. * @param[settingsViewModel] view model that provides the UserSettings. * @see[Text]. */ @@ -46,12 +50,13 @@ fun WText( minLines: Int = 1, onTextLayout: ((TextLayoutResult) -> Unit)? = null, style: TextStyle = LocalTextStyle.current, + settingsFontSizeAlterBy: Int = 0, settingsViewModel: SettingsViewModel = hiltViewModel(), ) { val settings by settingsViewModel.settings.collectAsState() val size = if (fontSize == TextUnit.Unspecified && settings != null) { - settings!!.fontSize.sp + (settings!!.fontSize + settingsFontSizeAlterBy).sp } else if (fontSize != TextUnit.Unspecified) { fontSize } else { diff --git a/app/src/main/java/be/re/writand/screens/filetree/WTreeComponent.kt b/app/src/main/java/be/re/writand/screens/filetree/WTreeComponent.kt index 9e54c0a..35dd367 100644 --- a/app/src/main/java/be/re/writand/screens/filetree/WTreeComponent.kt +++ b/app/src/main/java/be/re/writand/screens/filetree/WTreeComponent.kt @@ -250,9 +250,9 @@ fun Filename( ), contentDescription = "Open/close the directory" ) - Text(text = filename) + WText(text = filename) } else { - Text( + WText( text = filename, modifier = Modifier .padding(start = 10.dp * depth + WUIGlobals.treeIconSize) diff --git a/app/src/main/java/be/re/writand/screens/info/InfoPopup.kt b/app/src/main/java/be/re/writand/screens/info/InfoPopup.kt index 6efc6f9..5c3b3c4 100644 --- a/app/src/main/java/be/re/writand/screens/info/InfoPopup.kt +++ b/app/src/main/java/be/re/writand/screens/info/InfoPopup.kt @@ -98,7 +98,10 @@ fun InfoPopup( // spacer to divide the row in 3 parts and spread them over the width Spacer(modifier = Modifier.size(0.dp)) - WText(text = "About Writand", fontSize = 25.sp) + WText( + text = "About Writand", + settingsFontSizeAlterBy = WUIGlobals.HEADING + ) IconButton( onClick = { openDialog.value = false }, @@ -138,11 +141,11 @@ fun InfoPopup( text = "Writand", color = MaterialTheme.colorScheme.tertiary, fontWeight = FontWeight.ExtraBold, - fontSize = 30.sp + settingsFontSizeAlterBy = WUIGlobals.TITLE ) WText( text = " | version ${vM.version}", - fontSize = 20.sp + settingsFontSizeAlterBy = 6 ) } WText(text = @@ -152,7 +155,7 @@ fun InfoPopup( ) // change log / what's new: version 2 will have this /*Column { - WText(text = "What's new", fontSize = 25.sp) + WText(text = "What's new", settingsFontSizeAlterBy = WUIGlobals.HEADING) WText("upcoming...") }*/ // TOS @@ -160,7 +163,7 @@ fun InfoPopup( WText( modifier = Modifier.padding(vertical = 10.dp), text = "Terms Of Services", - fontSize = 25.sp + settingsFontSizeAlterBy = WUIGlobals.HEADING ) Box( @@ -193,7 +196,7 @@ fun InfoPopup( WText( modifier = Modifier.padding(vertical = 15.dp), text = "Support & Feedback", - fontSize = 25.sp + settingsFontSizeAlterBy = WUIGlobals.HEADING ) WText( modifier = Modifier.padding(bottom = 5.dp), @@ -217,7 +220,7 @@ fun InfoPopup( WText( modifier = Modifier.padding(vertical = 15.dp), text = "Support Us", - fontSize = 25.sp + settingsFontSizeAlterBy = WUIGlobals.HEADING ) WText(text = "Support us via patreon and get more features: (link)") } @@ -228,7 +231,7 @@ fun InfoPopup( WText( modifier = Modifier.padding(vertical = 15.dp), text = "Rate The App", - fontSize = 25.sp + settingsFontSizeAlterBy = WUIGlobals.HEADING ) WText( modifier = Modifier.padding(bottom = 5.dp), diff --git a/app/src/main/java/be/re/writand/screens/settings/SettingsPopup.kt b/app/src/main/java/be/re/writand/screens/settings/SettingsPopup.kt index ff5ef7c..28b8b0d 100644 --- a/app/src/main/java/be/re/writand/screens/settings/SettingsPopup.kt +++ b/app/src/main/java/be/re/writand/screens/settings/SettingsPopup.kt @@ -104,7 +104,10 @@ fun SettingsPopup( // spacer to divide the row in 3 parts and spread them over the width Spacer(modifier = Modifier.size(0.dp)) - WText(text = "Settings", fontSize = 25.sp) + WText( + text = "Settings", + settingsFontSizeAlterBy = WUIGlobals.HEADING + ) IconButton( onClick = { openDialog.value = false }, @@ -197,7 +200,11 @@ fun AppearanceSettings( .padding(start = 16.dp) ) { - WText(modifier = Modifier.padding(top = 25.dp), text = "Language", fontSize = 25.sp) + WText( + modifier = Modifier.padding(top = 25.dp), + text = "Language", + settingsFontSizeAlterBy = WUIGlobals.HEADING + ) WRadioButtonsSelectorRowWise( enable = true, textTitle = "", @@ -207,7 +214,11 @@ fun AppearanceSettings( labelSize = 0.dp ) - WText(modifier = Modifier.padding(top = 25.dp), text = "Theme", fontSize = 25.sp) + WText( + modifier = Modifier.padding(top = 25.dp), + text = "Theme", + settingsFontSizeAlterBy = WUIGlobals.HEADING + ) WRadioButtonsSelectorRowWise( enable = true, textTitle = "", @@ -217,7 +228,11 @@ fun AppearanceSettings( labelSize = 0.dp ) - WText(modifier = Modifier.padding(top = 25.dp), text = "Font", fontSize = 25.sp) + WText( + modifier = Modifier.padding(top = 25.dp), + text = "Font", + settingsFontSizeAlterBy = WUIGlobals.HEADING + ) WLabelAndTextField( title = "Fontsize", value = editorSettingsVM.textFieldFontSize.value, @@ -263,7 +278,11 @@ fun AdvancedSettings( .padding(it) .padding(start = 16.dp) ) { - WText(text = "History", modifier = Modifier.padding(top = 25.dp), fontSize = 25.sp) + WText( + text = "History", + modifier = Modifier.padding(top = 25.dp), + settingsFontSizeAlterBy = WUIGlobals.HEADING + ) ArrowAmountChooser( text = "Max amount of recently opened projects:", amountInt = editorSettingsVM.amountSavedProjects.intValue, @@ -272,7 +291,11 @@ fun AdvancedSettings( onIncrementValue = editorSettingsVM::onIncrementProjects, onMaxValue = editorSettingsVM::onMaxValueProjects ) - WText(text = "IDE tabs", modifier = Modifier.padding(top = 25.dp), fontSize = 25.sp) + WText( + text = "IDE tabs", + modifier = Modifier.padding(top = 25.dp), + settingsFontSizeAlterBy = WUIGlobals.HEADING + ) ArrowAmountChooser( text = "Max amount of opened files:", amountInt = editorSettingsVM.amountSavedFiles.intValue, diff --git a/app/src/main/java/be/re/writand/screens/welcome/WelcomeSettingsScreen.kt b/app/src/main/java/be/re/writand/screens/welcome/WelcomeSettingsScreen.kt index 0677624..76d738e 100644 --- a/app/src/main/java/be/re/writand/screens/welcome/WelcomeSettingsScreen.kt +++ b/app/src/main/java/be/re/writand/screens/welcome/WelcomeSettingsScreen.kt @@ -118,13 +118,13 @@ fun WelcomeSettingsScreen( text = "Welcome", color = MaterialTheme.colorScheme.tertiary, fontWeight = FontWeight.ExtraBold, - fontSize = 25.sp + settingsFontSizeAlterBy = WUIGlobals.HEADING ) WText( text = " to settings", color = MaterialTheme.colorScheme.onPrimary, fontWeight = FontWeight.ExtraBold, - fontSize = 25.sp + settingsFontSizeAlterBy = WUIGlobals.HEADING ) } diff --git a/app/src/main/java/be/re/writand/screens/welcome/WelcomeStartScreen.kt b/app/src/main/java/be/re/writand/screens/welcome/WelcomeStartScreen.kt index 3629365..91560ec 100644 --- a/app/src/main/java/be/re/writand/screens/welcome/WelcomeStartScreen.kt +++ b/app/src/main/java/be/re/writand/screens/welcome/WelcomeStartScreen.kt @@ -87,13 +87,13 @@ fun WelcomeStartScreen( text = "Welcome", color = MaterialTheme.colorScheme.tertiary, fontWeight = FontWeight.ExtraBold, - fontSize = 25.sp + settingsFontSizeAlterBy = WUIGlobals.HEADING ) WText( text = " to Writand", color = MaterialTheme.colorScheme.onPrimary, fontWeight = FontWeight.ExtraBold, - fontSize = 25.sp + settingsFontSizeAlterBy = WUIGlobals.HEADING ) } WText(text = "Any fool can write code that a computer can understand.\nGood programmers can write code that humans can understand.") diff --git a/app/src/main/java/be/re/writand/screens/welcome/WelcomeTOSScreen.kt b/app/src/main/java/be/re/writand/screens/welcome/WelcomeTOSScreen.kt index a45ef75..dc5a818 100644 --- a/app/src/main/java/be/re/writand/screens/welcome/WelcomeTOSScreen.kt +++ b/app/src/main/java/be/re/writand/screens/welcome/WelcomeTOSScreen.kt @@ -104,13 +104,13 @@ fun WelcomeTOSScreen( text = "Welcome", color = MaterialTheme.colorScheme.tertiary, fontWeight = FontWeight.ExtraBold, - fontSize = 25.sp + settingsFontSizeAlterBy = WUIGlobals.HEADING ) WText( text = " to TOS", color = MaterialTheme.colorScheme.onPrimary, fontWeight = FontWeight.ExtraBold, - fontSize = 25.sp + settingsFontSizeAlterBy = WUIGlobals.HEADING ) }