-
Notifications
You must be signed in to change notification settings - Fork 717
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: user profile screen to compose
- Loading branch information
1 parent
ecbf4b6
commit ac8403c
Showing
14 changed files
with
556 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../mobile/viewModels/UserDetailViewModel.kt → ...le/ui/user_profile/UserDetailViewModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
app/src/main/java/org/mifos/mobile/ui/user_profile/UserDetails.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package org.mifos.mobile.ui.user_profile | ||
|
||
data class UserDetails( | ||
val userName: String?, | ||
val accountNumber: String?, | ||
val activationDate: String?, | ||
val officeName: String?, | ||
val clientType: String?, | ||
val groups: String?, | ||
val clientClassification: String?, | ||
val phoneNumber: String?, | ||
val dob: String?, | ||
val gender: String? | ||
) { | ||
constructor() : this( | ||
accountNumber = "", | ||
activationDate = "", | ||
clientClassification = "", | ||
clientType = "", | ||
dob = "", | ||
gender = "", | ||
groups = "", | ||
officeName = "", | ||
phoneNumber = "", | ||
userName = "" | ||
) | ||
} |
4 changes: 2 additions & 2 deletions
4
...bile/ui/activities/UserProfileActivity.kt → ...le/ui/user_profile/UserProfileActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
92 changes: 92 additions & 0 deletions
92
app/src/main/java/org/mifos/mobile/ui/user_profile/UserProfileDetails.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
package org.mifos.mobile.ui.user_profile | ||
|
||
import androidx.compose.foundation.isSystemInDarkTheme | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.material3.Icon | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.res.painterResource | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.text.TextStyle | ||
import androidx.compose.ui.text.font.FontWeight | ||
import androidx.compose.ui.unit.dp | ||
import androidx.compose.ui.unit.sp | ||
import org.mifos.mobile.R | ||
|
||
/** | ||
* @author pratyush | ||
* @since 20/12/2023 | ||
*/ | ||
|
||
@Composable | ||
fun UserProfileDetails( | ||
userDetails: UserDetails | ||
) { | ||
Column { | ||
Text( | ||
modifier = Modifier.padding(top = 16.dp, start = 8.dp), | ||
text = stringResource(id = R.string.user_details), | ||
color = Color(0xFF8E9099), | ||
style = TextStyle(fontSize = 12.sp, fontWeight = FontWeight.SemiBold), | ||
) | ||
Row( | ||
modifier = Modifier.padding(start = 8.dp), | ||
verticalAlignment = Alignment.Bottom | ||
) { | ||
Icon( | ||
modifier = Modifier.padding(top = 8.dp, end = 8.dp), | ||
painter = painterResource(id = R.drawable.ic_phone_24dp), | ||
tint = if (isSystemInDarkTheme()) Color(0xFF9bb1e3) else Color(0xFF325ca8), | ||
contentDescription = null | ||
) | ||
userDetails.phoneNumber?.let { | ||
Text( | ||
text = it, | ||
color = if (isSystemInDarkTheme()) Color.White else Color.Black, | ||
style = TextStyle(fontSize = 14.sp) | ||
) | ||
} | ||
} | ||
Row( | ||
modifier = Modifier.padding(start = 8.dp), | ||
verticalAlignment = Alignment.Bottom | ||
) { | ||
Icon( | ||
modifier = Modifier.padding(top = 8.dp, end = 8.dp), | ||
painter = painterResource(id = R.drawable.ic_cake_24dp), | ||
tint = if (isSystemInDarkTheme()) Color(0xFF9bb1e3) else Color(0xFF325ca8), | ||
contentDescription = null | ||
) | ||
userDetails.dob?.let { | ||
Text( | ||
text = it, | ||
color = if (isSystemInDarkTheme()) Color.White else Color.Black, | ||
style = TextStyle(fontSize = 14.sp) | ||
) | ||
} | ||
} | ||
Row( | ||
modifier = Modifier.padding(start = 8.dp), | ||
verticalAlignment = Alignment.Bottom | ||
) { | ||
Icon( | ||
modifier = Modifier.padding(top = 8.dp, end = 8.dp), | ||
painter = painterResource(id = R.drawable.ic_gender_24dp), | ||
tint = if (isSystemInDarkTheme()) Color(0xFF9bb1e3) else Color(0xFF325ca8), | ||
contentDescription = null | ||
) | ||
userDetails.gender?.let { | ||
Text( | ||
text = it, | ||
color = if (isSystemInDarkTheme()) Color.White else Color.Black, | ||
style = TextStyle(fontSize = 14.sp) | ||
) | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.