Compare commits
No commits in common. "1.01" and "main" have entirely different histories.
@ -15,8 +15,8 @@ android {
|
|||||||
applicationId = "com.hyperling.roomexample"
|
applicationId = "com.hyperling.roomexample"
|
||||||
minSdk = 21
|
minSdk = 21
|
||||||
targetSdk = 34
|
targetSdk = 34
|
||||||
versionCode = 2
|
versionCode = 1
|
||||||
versionName = "1.01"
|
versionName = "1.0"
|
||||||
|
|
||||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
|
@ -22,21 +22,9 @@ import androidx.compose.material3.Text
|
|||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.res.stringResource
|
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
|
|
||||||
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
|
@Composable
|
||||||
fun ContactScreen(
|
fun ContactScreen(
|
||||||
state: ContactState,
|
state: ContactState,
|
||||||
@ -64,9 +52,6 @@ fun ContactScreen(
|
|||||||
verticalArrangement = Arrangement.spacedBy(16.dp)
|
verticalArrangement = Arrangement.spacedBy(16.dp)
|
||||||
){
|
){
|
||||||
item {
|
item {
|
||||||
Row (){
|
|
||||||
Text(text = "Sort ascending by:")
|
|
||||||
}
|
|
||||||
Row (
|
Row (
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
@ -87,13 +72,10 @@ fun ContactScreen(
|
|||||||
onEvent(ContactEvent.SortContacts(sortType))
|
onEvent(ContactEvent.SortContacts(sortType))
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
Text(text = stringResource(getEnumStringResourceID(sortType.name)))
|
Text(text = sortType.name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Row (){
|
|
||||||
Text(text = "Contacts:")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
items(state.contacts) {contact ->
|
items(state.contacts) {contact ->
|
||||||
Row (
|
Row (
|
||||||
|
@ -1,6 +1,3 @@
|
|||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">Room Database Testing</string>
|
<string name="app_name">Room Database Testing</string>
|
||||||
<string name="FIRST_NAME">First Name</string>
|
|
||||||
<string name="LAST_NAME">Last Name</string>
|
|
||||||
<string name="PHONE_NUMBER">Phone Number</string>
|
|
||||||
</resources>
|
</resources>
|
Loading…
x
Reference in New Issue
Block a user