Skip to content

Commit

Permalink
refactor: user profile screen to compose
Browse files Browse the repository at this point in the history
  • Loading branch information
PratyushSingh07 committed Dec 24, 2023
1 parent ecbf4b6 commit ac8403c
Show file tree
Hide file tree
Showing 14 changed files with 556 additions and 71 deletions.
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
android:windowSoftInputMode="adjustResize" />

<activity
android:name="org.mifos.mobile.ui.activities.UserProfileActivity"
android:name="org.mifos.mobile.ui.user_profile.UserProfileActivity"
android:configChanges="orientation|screenSize"
android:windowSoftInputMode="adjustResize" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ import org.mifos.mobile.utils.TextDrawable
import org.mifos.mobile.utils.Toaster
import org.mifos.mobile.utils.UserDetailUiState
import org.mifos.mobile.utils.fcm.RegistrationIntentService
import org.mifos.mobile.viewModels.UserDetailViewModel
import org.mifos.mobile.ui.user_profile.UserDetailViewModel
import org.mifos.mobile.ui.user_profile.UserProfileActivity
import javax.inject.Inject

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import org.mifos.mobile.models.client.Client
import org.mifos.mobile.ui.activities.HomeActivity
import org.mifos.mobile.ui.activities.LoanApplicationActivity
import org.mifos.mobile.ui.activities.NotificationActivity
import org.mifos.mobile.ui.activities.UserProfileActivity
import org.mifos.mobile.ui.user_profile.UserProfileActivity
import org.mifos.mobile.ui.activities.base.BaseActivity
import org.mifos.mobile.ui.enums.AccountType
import org.mifos.mobile.ui.enums.ChargeType
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.mifos.mobile.viewModels
package org.mifos.mobile.ui.user_profile

import android.util.Base64
import android.util.Log
Expand Down
27 changes: 27 additions & 0 deletions app/src/main/java/org/mifos/mobile/ui/user_profile/UserDetails.kt
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 = ""
)
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package org.mifos.mobile.ui.activities
package org.mifos.mobile.ui.user_profile

import android.os.Bundle
import org.mifos.mobile.R
import org.mifos.mobile.databinding.ActivityUserProfileBinding
import org.mifos.mobile.ui.activities.base.BaseActivity
import org.mifos.mobile.ui.fragments.UserProfileFragment
import org.mifos.mobile.ui.user_profile.UserProfileFragment

class UserProfileActivity : BaseActivity() {

Expand Down
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)
)
}
}
}
}
Loading

0 comments on commit ac8403c

Please sign in to comment.