Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: profile fragment migrated to compose #1547

Merged
merged 1 commit into from
Mar 1, 2024

Conversation

PratyushSingh07
Copy link
Collaborator

@PratyushSingh07 PratyushSingh07 commented Feb 21, 2024

Issue Fix

Fixes #1532

figma.profile.mp4
  • Apply the AndroidStyle.xml style template to your code in Android Studio.

  • Run the unit tests with ./gradlew check to make sure you didn't break anything

  • If you have multiple commits please combine them into one commit by squashing them.

@PratyushSingh07 PratyushSingh07 marked this pull request as ready for review February 21, 2024 19:50
Copy link
Collaborator Author

@PratyushSingh07 PratyushSingh07 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please review this @therajanmaurya

@therajanmaurya therajanmaurya changed the title refactor #1532: profile fragment migrated to compose refactor: profile fragment migrated to compose Feb 22, 2024
private val mPreferencesHelper: PreferencesHelper
) : ViewModel() {

private val _bitmapImage = MutableStateFlow<Bitmap?>(null)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Create ProfileUiState sealed class and move these fields into that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (bitmap == null) {
MifosTextUserImage(
modifier = modifier,
text = username?.firstOrNull()?.toString() ?: "J"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here image should have 3 condition

  1. If bitmap is not null then load bitmap
  2. If bitmap is null then check username or name and set first char
  3. As bitmap is null and we set username or name first char then we need to set plus circular image at bottom right of the image that allows user to open update user profile photo.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 3rd condition can be handled after the user clicks on the Edit Profile button @therajanmaurya . Hence Adding a plus icon in my opinion isn't the best alternative

import org.mifos.mobilewallet.mifospay.ui.utility.Orientation

@Composable
fun ProfileItemCard(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explore the Flow https://developer.android.com/jetpack/compose/layouts/flow#item-weights this Horizontal and Vertical thing can be handled directly through the single below Flow. See example in above Flow documentation.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wont the FlowRow cause inconsistent UI for different screen sizes? In case of screens with smaller width the elements will flow out.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, Flow is built for that specially.

import org.mifos.mobilewallet.mifospay.ui.utility.Orientation

@Composable
fun ProfileItemCard(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, Flow is built for that specially.

@therajanmaurya therajanmaurya merged commit ae1389c into openMF:dev Mar 1, 2024
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migrate xml to Jetpack compose - home/ui/ProfileFragment
2 participants