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

migrated account fragment to jetpack compose #1561

Closed
wants to merge 2 commits into from

Conversation

NiranjanNlc
Copy link
Contributor

@NiranjanNlc NiranjanNlc commented Mar 11, 2024

Issue Fix

Fixes #1533

Screenshots

Screenrecorder-2024-03-13-14-14-17-935.mp4

Description

Migrated AccountFragments to jetpack compose screen

  • 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.

@NiranjanNlc NiranjanNlc force-pushed the accountFragmentToCompose branch 2 times, most recently from 3de6f3e to 450baa7 Compare March 11, 2024 09:25
@PratyushSingh07
Copy link
Collaborator

Hi @NiranjanNlc I think this UI is a bit different from the existing one . I would insist that you follow the original design

Comment on lines -94 to -109
mRvLinkedBankAccounts!!.addOnItemTouchListener(
RecyclerItemClickListener(
activity,
object : RecyclerItemClickListener.OnItemClickListener {
override fun onItemClick(childView: View?, position: Int) {
val intent = Intent(
activity,
BankAccountDetailActivity::class.java
)
intent.putExtra(
Constants.BANK_ACCOUNT_DETAILS,
mBankAccountsAdapter!!.getBankDetails(position)
)
intent.putExtra(Constants.INDEX, position)
startActivityForResult(intent, BANK_ACCOUNT_DETAILS_REQUEST_CODE)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

and have you handled this case in the new compose UI ?

Copy link
Contributor Author

@NiranjanNlc NiranjanNlc Mar 11, 2024

Choose a reason for hiding this comment

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

oops i missed this , would implement it on next commit along with your comment on desighn and binding .
Thanks ....

@JvmField
@BindView(R.id.tv_empty_no_transaction_history_subtitle)
var tvTransactionsStateSubtitle: TextView? = null
lateinit var binding: FragmentAccountsBinding
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we get rid of binding ? with compose we shouldn't need this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it shall go while all the component of FinanceFragment is converted into jetpack compose.

@NiranjanNlc
Copy link
Contributor Author

Hi @NiranjanNlc I think this UI is a bit different from the existing one . I would insist that you follow the original design

Hi @NiranjanNlc I think this UI is a bit different from the existing one . I would insist that you follow the original design

Hi @NiranjanNlc I think this UI is a bit different from the existing one . I would insist that you follow the original design

Its because of relative layout on the previous one and can you provide me some hint on how should i approach for the relative layout in jetpack compose .

@NiranjanNlc NiranjanNlc force-pushed the accountFragmentToCompose branch from 450baa7 to 7ffd760 Compare March 13, 2024 08:36
@NiranjanNlc
Copy link
Contributor Author

Hi @NiranjanNlc I think this UI is a bit different from the existing one . I would insist that you follow the original design

Changed the desighn and implemented the onClickListener as you suggested .

Please get it reviewed again and provide me suggestion.

@NiranjanNlc
Copy link
Contributor Author

@PratyushSingh07 ,
please go through the updated UI in PR description.
Hope it is upto the par.
Waiting for your review .

import org.mifos.mobilewallet.mifospay.bank.viewmodel.BankAccountsViewModel

@Composable
fun AccountScreen(viewModel: BankAccountsViewModel,
Copy link
Member

Choose a reason for hiding this comment

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

Code not formatted, Please format the code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done by ctrl+alt+L

}

@Composable
fun AccountDisplay(
Copy link
Member

Choose a reason for hiding this comment

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

Rename it with AccountScreenContent

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed


@Preview
@Composable
fun AccountScreenPreview() {
Copy link
Member

Choose a reason for hiding this comment

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

Empty bank details preview is missing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

created the new preview function for empty list

)
)
AccountDisplay(bankAccountDetails, {},{})
// AccountDisplay(bankAccountDetails = emptyList(),{})
Copy link
Member

Choose a reason for hiding this comment

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

remove this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done


@Preview
@Composable
fun AddAccountChipPreview() {
Copy link
Member

Choose a reason for hiding this comment

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

wrap around the MifosTheme every preview function

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

import org.mifos.mobilewallet.mifospay.R

@Composable
fun ItemCausualList(
Copy link
Member

Choose a reason for hiding this comment

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

ambiguous naming convention. what is Causual

Copy link
Member

Choose a reason for hiding this comment

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

Write something related to feature

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed ListItemWithImage ..done


@Preview
@Composable
fun ComposeItemPreview() {
Copy link
Member

Choose a reason for hiding this comment

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

Preview name should be function name + Preview - suffix

import androidx.compose.ui.unit.dp
import org.mifos.mobilewallet.mifospay.R
@Composable
fun PlaceholderStateLayout(
Copy link
Member

Choose a reason for hiding this comment

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

ambiguous naming

Copy link
Contributor Author

@NiranjanNlc NiranjanNlc Mar 24, 2024

Choose a reason for hiding this comment

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

changed to EmptyStatePlaceHolder

binding= FragmentAccountsBinding.inflate(inflater, container, false)
ButterKnife.bind(this,binding.root)
binding.accountScreen.setContent {
AccountScreen(viewModel, ::addAccountClicked, ::onAccountClicked)
Copy link
Member

Choose a reason for hiding this comment

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

Don't need to pass the viewmodel init the ViewModel through hilt.

See CardsScreen as an example.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@NiranjanNlc NiranjanNlc force-pushed the accountFragmentToCompose branch from 7ffd760 to 7a59aec Compare March 24, 2024 05:52
@PratyushSingh07
Copy link
Collaborator

closing this as completed by #1579

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 - bank/ui/AccountsFragment
3 participants