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

surveys: preset user information (fixes #3946) #4164

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,36 @@ class UserInformationFragment : BaseDialogFragment(), View.OnClickListener {
}
fragmentUserInformationBinding.etEmail.setText(getString(R.string.message_placeholder, userModel?.email))
fragmentUserInformationBinding.etFname.setText(getString(R.string.message_placeholder, userModel?.firstName))
fragmentUserInformationBinding.etMname.setText(getString(R.string.message_placeholder, userModel?.middleName))
fragmentUserInformationBinding.etLname.setText(getString(R.string.message_placeholder, userModel?.lastName))
fragmentUserInformationBinding.etPhone.setText(getString(R.string.message_placeholder, userModel?.phoneNumber))
fragmentUserInformationBinding.txtDob.text = getString(R.string.message_placeholder, userModel?.dob)
dob = userModel?.dob

val languages = resources.getStringArray(R.array.language)
val userLanguage = userModel?.language
val languagePosition = languages.indexOf(userLanguage)
if (languagePosition >= 0) {
fragmentUserInformationBinding.spnLang.setSelection(languagePosition)
}

val level = resources.getStringArray(R.array.level)
val userLevel = userModel?.level
val levelPosition = level.indexOf(userLevel)
if (levelPosition >= 0) {
fragmentUserInformationBinding.spnLevel.setSelection(levelPosition)
}

val userGender = userModel?.gender
when (userGender) {
getString(R.string.male) -> {
fragmentUserInformationBinding.rbGender.check(fragmentUserInformationBinding.rbGender.getChildAt(0).id)
}
getString(R.string.female) -> {
fragmentUserInformationBinding.rbGender.check(fragmentUserInformationBinding.rbGender.getChildAt(1).id)
}
}

fragmentUserInformationBinding.btnCancel.setOnClickListener(this)
fragmentUserInformationBinding.btnSubmit.setOnClickListener(this)
fragmentUserInformationBinding.txtDob.setOnClickListener(this)
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@
<string name="your_feedback">Your Feedback *</string>
<string name="button_update">Update</string>
<string name="level">level</string>
<string name="male">Male</string>
<string name="female">Female</string>
<string name="male">male</string>
<string name="female">female</string>
<string name="gender">Gender</string>
<string name="birth_date">Birth Date</string>
<string name="phone_number">Phone Number</string>
Expand Down