Remove extra variables.
This commit is contained in:
parent
8447122c89
commit
bcf0e0333e
@ -26,14 +26,15 @@ import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
|
||||
fun getEnumStringResource(enumName: String): Int {
|
||||
val resourceID: Int = when (enumName) {
|
||||
SortType.FIRST_NAME.toString() -> R.string.FIRST_NAME
|
||||
SortType.LAST_NAME.toString() -> R.string.LAST_NAME
|
||||
SortType.PHONE_NUMBER.toString() -> R.string.PHONE_NUMBER
|
||||
else -> 0
|
||||
}
|
||||
return resourceID
|
||||
fun getEnumStringResourceID(enumName: String): Int {
|
||||
return (
|
||||
when (enumName) {
|
||||
SortType.FIRST_NAME.toString() -> R.string.FIRST_NAME
|
||||
SortType.LAST_NAME.toString() -> R.string.LAST_NAME
|
||||
SortType.PHONE_NUMBER.toString() -> R.string.PHONE_NUMBER
|
||||
else -> 0
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
@ -83,8 +84,7 @@ fun ContactScreen(
|
||||
onEvent(ContactEvent.SortContacts(sortType))
|
||||
}
|
||||
)
|
||||
val sortTypeString: String = stringResource(getEnumStringResource(sortType.name))
|
||||
Text(text = sortTypeString)
|
||||
Text(text = stringResource(getEnumStringResourceID(sortType.name)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user