fix string resource inconsistencies
This commit is contained in:
		
							parent
							
								
									cfb624b6b6
								
							
						
					
					
						commit
						a28a425c3c
					
				
					 3 changed files with 8 additions and 18 deletions
				
			
		|  | @ -119,7 +119,7 @@ fun LabeledErrorTextField( | ||||||
|     initialValue: String, |     initialValue: String, | ||||||
|     @StringRes label: Int, |     @StringRes label: Int, | ||||||
|     singleLine: Boolean = false, |     singleLine: Boolean = false, | ||||||
|     errorText: String, |     errorText: Int, | ||||||
|     keyboardType: KeyboardType, |     keyboardType: KeyboardType, | ||||||
|     predicate: (String) -> Boolean, |     predicate: (String) -> Boolean, | ||||||
|     onNewCorrectValue: (String) -> Unit |     onNewCorrectValue: (String) -> Unit | ||||||
|  | @ -144,7 +144,7 @@ fun LabeledErrorTextField( | ||||||
|                 } |                 } | ||||||
|             }, |             }, | ||||||
|             singleLine = singleLine, |             singleLine = singleLine, | ||||||
|             label = { Text(text = resources().getString(label)) }, |             label = { Text(text = stringResource(id = label)) }, | ||||||
|             isError = !isValid, |             isError = !isValid, | ||||||
|             keyboardOptions = KeyboardOptions( |             keyboardOptions = KeyboardOptions( | ||||||
|                 keyboardType = keyboardType, |                 keyboardType = keyboardType, | ||||||
|  | @ -155,17 +155,13 @@ fun LabeledErrorTextField( | ||||||
|         if (!isValid) { |         if (!isValid) { | ||||||
|             Text( |             Text( | ||||||
|                 modifier = Modifier.padding(start = 16.dp), |                 modifier = Modifier.padding(start = 16.dp), | ||||||
|                 text = errorText, |                 text = stringResource(id = errorText), | ||||||
|                 color = MaterialTheme.colors.error |                 color = MaterialTheme.colors.error | ||||||
|             ) |             ) | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| fun isNumber(string: String): Boolean { |  | ||||||
|     return string.matches(Regex("[1-9]+\\d*")) |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  @Preview(showBackground = true) |  @Preview(showBackground = true) | ||||||
|  |  | ||||||
|  | @ -14,6 +14,7 @@ import be.ugent.sel.studeez.common.composable.BasicButton | ||||||
| import be.ugent.sel.studeez.common.composable.LabelledInputField | import be.ugent.sel.studeez.common.composable.LabelledInputField | ||||||
| import be.ugent.sel.studeez.common.ext.basicButton | import be.ugent.sel.studeez.common.ext.basicButton | ||||||
| import be.ugent.sel.studeez.data.local.models.timer_info.TimerInfo | import be.ugent.sel.studeez.data.local.models.timer_info.TimerInfo | ||||||
|  | import be.ugent.sel.studeez.R.string as AppText | ||||||
| 
 | 
 | ||||||
| abstract class AbstractTimerEditScreen(private val timerInfo: TimerInfo) { | abstract class AbstractTimerEditScreen(private val timerInfo: TimerInfo) { | ||||||
| 
 | 
 | ||||||
|  | @ -46,7 +47,7 @@ abstract class AbstractTimerEditScreen(private val timerInfo: TimerInfo) { | ||||||
|                 LabelledInputField( |                 LabelledInputField( | ||||||
|                     value = description, |                     value = description, | ||||||
|                     onNewValue = { description = it }, |                     onNewValue = { description = it }, | ||||||
|                     label = R.string.description, |                     label = AppText.description, | ||||||
|                     singleLine = false |                     singleLine = false | ||||||
|                 ) |                 ) | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,22 +1,15 @@ | ||||||
| package be.ugent.sel.studeez.screens.timer_edit.editScreens | package be.ugent.sel.studeez.screens.timer_edit.editScreens | ||||||
| 
 | 
 | ||||||
| import androidx.compose.foundation.layout.fillMaxWidth |  | ||||||
| import androidx.compose.runtime.* | import androidx.compose.runtime.* | ||||||
| import androidx.compose.ui.Modifier |  | ||||||
| import androidx.compose.ui.text.input.KeyboardType | import androidx.compose.ui.text.input.KeyboardType | ||||||
| import androidx.compose.ui.tooling.preview.Preview | import androidx.compose.ui.tooling.preview.Preview | ||||||
| import be.ugent.sel.studeez.R | import be.ugent.sel.studeez.R | ||||||
| import be.ugent.sel.studeez.common.composable.LabeledErrorTextField | import be.ugent.sel.studeez.common.composable.LabeledErrorTextField | ||||||
| import be.ugent.sel.studeez.common.composable.LabeledNumberInputField |  | ||||||
| import be.ugent.sel.studeez.common.composable.TimePickerButton |  | ||||||
| import be.ugent.sel.studeez.common.composable.TimePickerCard | import be.ugent.sel.studeez.common.composable.TimePickerCard | ||||||
| import be.ugent.sel.studeez.data.local.models.timer_functional.HoursMinutesSeconds |  | ||||||
| import be.ugent.sel.studeez.data.local.models.timer_functional.Time |  | ||||||
| import be.ugent.sel.studeez.data.local.models.timer_info.CustomTimerInfo |  | ||||||
| import be.ugent.sel.studeez.data.local.models.timer_info.EndlessTimerInfo |  | ||||||
| import be.ugent.sel.studeez.data.local.models.timer_info.PomodoroTimerInfo | import be.ugent.sel.studeez.data.local.models.timer_info.PomodoroTimerInfo | ||||||
| import be.ugent.sel.studeez.resources |  | ||||||
| import be.ugent.sel.studeez.ui.theme.StudeezTheme | import be.ugent.sel.studeez.ui.theme.StudeezTheme | ||||||
|  | import be.ugent.sel.studeez.R.string as AppText | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| class BreakTimerEditScreen( | class BreakTimerEditScreen( | ||||||
|     private val breakTimerInfo: PomodoroTimerInfo |     private val breakTimerInfo: PomodoroTimerInfo | ||||||
|  | @ -36,7 +29,7 @@ class BreakTimerEditScreen( | ||||||
|         LabeledErrorTextField( |         LabeledErrorTextField( | ||||||
|             initialValue = breakTimerInfo.repeats.toString(), |             initialValue = breakTimerInfo.repeats.toString(), | ||||||
|             label = R.string.repeats, |             label = R.string.repeats, | ||||||
|             errorText = resources().getString(R.string.repeats_error), |             errorText = AppText.repeats_error, | ||||||
|             keyboardType = KeyboardType.Decimal, |             keyboardType = KeyboardType.Decimal, | ||||||
|             predicate = { it.matches(Regex("[1-9]+\\d*")) } |             predicate = { it.matches(Regex("[1-9]+\\d*")) } | ||||||
|         ) { correctlyTypedInt -> |         ) { correctlyTypedInt -> | ||||||
|  |  | ||||||
		Reference in a new issue
	
	 lbarraga
						lbarraga