-
Notifications
You must be signed in to change notification settings - Fork 667
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
[2656] - refactor: Registration verification from XML to compose #2605
[2656] - refactor: Registration verification from XML to compose #2605
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i see that you have attached some screemshots and I was wondering if they are the same as the earlier XML designs. Also in the error state I think you should remove the Mifos Icon , it looks a bit odd . What do you have to say about this @AvneetSingh2001 ?
container: ViewGroup?, | ||
savedInstanceState: Bundle?, | ||
): View { | ||
return mifosComposeView(requireContext()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
set a view composition strategy below this line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
view Composition strategy is implemented in mifosComposeView already, so no need
|
||
/** | ||
* Created by dilpreet on 31/7/17. | ||
*/ | ||
@AndroidEntryPoint | ||
class RegistrationVerificationFragment : BaseFragment() { | ||
class RegistrationVerificationFragment_Old : BaseFragment() { | ||
private var _binding: FragmentRegistrationVerificationBinding? = null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this fragment if not needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rajan sir asked to add the old fragments in the meeting, that's why i am keeping them
): View { | ||
return mifosComposeView(requireContext()) { | ||
RegistrationVerificationScreen( | ||
registrationViewModel, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need of passing viewModel. we can omit this parameter as we already assigned hiltViewModel
app/src/main/java/org/mifos/mobile/ui/registration/RegistrationVerificationScreen.kt
Outdated
Show resolved
Hide resolved
|
||
|
||
@Composable | ||
fun RegistrationVerificationContent( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use MFScaffold, and pass this content in the scaffoldContent of the scaffold
containerColor = if (isSystemInDarkTheme()) Color( | ||
0xFF9bb1e3 | ||
) else Color(0xFF325ca8) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
single line if
} | ||
|
||
RegistrationUiState.Success -> { | ||
context.startActivity(Intent(context, LoginActivity::class.java)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dont start activity from here, do this in fragment, the callback should call this LoginActivity from fragment
MifosOutlinedTextField( | ||
value = requestID, | ||
onValueChange = { requestID = it }, | ||
label = R.string.request_id, | ||
supportingText = "", | ||
keyboardType = KeyboardType.Number | ||
) | ||
|
||
MifosOutlinedTextField( | ||
value = authenticationToken, | ||
onValueChange = { authenticationToken = it }, | ||
label = R.string.authentication_token, | ||
supportingText = "", | ||
keyboardType = KeyboardType.Number | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do error handling as well for these textfields
MifosProgressIndicator( | ||
modifier = Modifier | ||
.fillMaxSize() | ||
.padding(10.dp) | ||
.background(MaterialTheme.colorScheme.background.copy(alpha = 0.7f)) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
User MifosProgressOverlayIndicator
Image( | ||
painterResource(R.drawable.mifos_logo), | ||
contentDescription = "", | ||
contentScale = ContentScale.Fit, | ||
alignment = Alignment.Center, | ||
modifier = Modifier | ||
.padding(dimensionResource(id = R.dimen.Mifos_DesignSystem_Spacing_screenHorizontalMargin)) | ||
.height(dimensionResource(id = R.dimen.Mifos_DesignSystem_Size_LogoImageSize)) | ||
.fillMaxWidth() | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move this in content screen, show image only in the case of Initial state
}, | ||
Modifier | ||
.fillMaxWidth() | ||
.padding(start = 16.dp, end = 16.dp, top = 4.dp), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
give top padding 12
confirmButton = { | ||
TextButton(onClick = { showConfirmationDialog = false | ||
navigateBack.invoke() }) { | ||
Text(text = "Yes") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use stringResource
}, | ||
dismissButton = { | ||
TextButton(onClick = { showConfirmationDialog = false }) { | ||
Text(text = "No") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use stringResource
|
||
Image( | ||
painterResource(R.drawable.mifos_logo), | ||
contentDescription = "", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pass null as contentDesc
.fillMaxSize()) { | ||
|
||
Image( | ||
painterResource(R.drawable.mifos_logo), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
painter = painterResource(R.drawable.mifos_logo),
override fun onBackPressed() { | ||
MaterialDialog.Builder().init(this) | ||
.setTitle(getString(R.string.dialog_cancel_registration_title)) | ||
.setMessage(getString(R.string.dialog_cancel_registration_message)) | ||
.setPositiveButton(getString(R.string.yes)) { _, _ -> super.onBackPressed() } | ||
.setNegativeButton(R.string.no) { dialog, _ -> dialog.dismiss() } | ||
.createMaterialDialog() | ||
.show() | ||
super.onBackPressed() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this function
var showConfirmationDialog by remember { mutableStateOf(false) } | ||
|
||
BackHandler(enabled = true) | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BackHandler(endabled = true) {
do proper indentation
|
||
var temp = true | ||
if (requestID.text.isEmpty()) { | ||
requestIDError = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove semicolon
requestIDError = false | ||
}, | ||
label = R.string.request_id, | ||
supportingText = "Request ID cannot be empty", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use stringResource
authenticationTokenError = false | ||
}, | ||
label = R.string.authentication_token, | ||
supportingText = "Authentication Token cannot be empty", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use stringResource
}, | ||
Modifier | ||
.fillMaxWidth() | ||
.padding(start = 12.dp, end = 16.dp, top = 4.dp), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not start padding, top padding should be 12, keep start 16
* "Refactored registration verification screen to compose" * "Refactored registration verification screen to compose" * "Refactored registration verification screen to compose" * "Added AlertDialog, Component and resolved changes" * "Implemented Box for Content and Overlayed other states" * "Added String Resource and Indendtaions" * "Added String Resource and Indendtaions"
Fixes #2584
VID-20240613-WA0004.mp4
[ x] Apply the
AndroidStyle.xml
style template to your code in Android Studio.[x ] Run the unit tests with
./gradlew check
to make sure you didn't break anything[x ] If you have multiple commits please combine them into one commit by squashing them.