Remove extra variables.

This commit is contained in:
Hyperling 2024-12-29 08:16:25 -07:00
parent 8447122c89
commit bcf0e0333e

View File

@ -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)))
}
}
}