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,
 | 
			
		||||
    @StringRes label: Int,
 | 
			
		||||
    singleLine: Boolean = false,
 | 
			
		||||
    errorText: String,
 | 
			
		||||
    errorText: Int,
 | 
			
		||||
    keyboardType: KeyboardType,
 | 
			
		||||
    predicate: (String) -> Boolean,
 | 
			
		||||
    onNewCorrectValue: (String) -> Unit
 | 
			
		||||
| 
						 | 
				
			
			@ -144,7 +144,7 @@ fun LabeledErrorTextField(
 | 
			
		|||
                }
 | 
			
		||||
            },
 | 
			
		||||
            singleLine = singleLine,
 | 
			
		||||
            label = { Text(text = resources().getString(label)) },
 | 
			
		||||
            label = { Text(text = stringResource(id = label)) },
 | 
			
		||||
            isError = !isValid,
 | 
			
		||||
            keyboardOptions = KeyboardOptions(
 | 
			
		||||
                keyboardType = keyboardType,
 | 
			
		||||
| 
						 | 
				
			
			@ -155,17 +155,13 @@ fun LabeledErrorTextField(
 | 
			
		|||
        if (!isValid) {
 | 
			
		||||
            Text(
 | 
			
		||||
                modifier = Modifier.padding(start = 16.dp),
 | 
			
		||||
                text = errorText,
 | 
			
		||||
                text = stringResource(id = errorText),
 | 
			
		||||
                color = MaterialTheme.colors.error
 | 
			
		||||
            )
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
fun isNumber(string: String): Boolean {
 | 
			
		||||
    return string.matches(Regex("[1-9]+\\d*"))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 @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.ext.basicButton
 | 
			
		||||
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) {
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -46,7 +47,7 @@ abstract class AbstractTimerEditScreen(private val timerInfo: TimerInfo) {
 | 
			
		|||
                LabelledInputField(
 | 
			
		||||
                    value = description,
 | 
			
		||||
                    onNewValue = { description = it },
 | 
			
		||||
                    label = R.string.description,
 | 
			
		||||
                    label = AppText.description,
 | 
			
		||||
                    singleLine = false
 | 
			
		||||
                )
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,22 +1,15 @@
 | 
			
		|||
package be.ugent.sel.studeez.screens.timer_edit.editScreens
 | 
			
		||||
 | 
			
		||||
import androidx.compose.foundation.layout.fillMaxWidth
 | 
			
		||||
import androidx.compose.runtime.*
 | 
			
		||||
import androidx.compose.ui.Modifier
 | 
			
		||||
import androidx.compose.ui.text.input.KeyboardType
 | 
			
		||||
import androidx.compose.ui.tooling.preview.Preview
 | 
			
		||||
import be.ugent.sel.studeez.R
 | 
			
		||||
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.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.resources
 | 
			
		||||
import be.ugent.sel.studeez.ui.theme.StudeezTheme
 | 
			
		||||
import be.ugent.sel.studeez.R.string as AppText
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class BreakTimerEditScreen(
 | 
			
		||||
    private val breakTimerInfo: PomodoroTimerInfo
 | 
			
		||||
| 
						 | 
				
			
			@ -36,7 +29,7 @@ class BreakTimerEditScreen(
 | 
			
		|||
        LabeledErrorTextField(
 | 
			
		||||
            initialValue = breakTimerInfo.repeats.toString(),
 | 
			
		||||
            label = R.string.repeats,
 | 
			
		||||
            errorText = resources().getString(R.string.repeats_error),
 | 
			
		||||
            errorText = AppText.repeats_error,
 | 
			
		||||
            keyboardType = KeyboardType.Decimal,
 | 
			
		||||
            predicate = { it.matches(Regex("[1-9]+\\d*")) }
 | 
			
		||||
        ) { correctlyTypedInt ->
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Reference in a new issue