From 06239bb8a1755f848d872d6a0aa721b87f34899e Mon Sep 17 00:00:00 2001 From: Martin Marconcini Date: Tue, 22 Aug 2023 12:05:11 +0200 Subject: [PATCH] Fix synthetic accessor lint error. --- .../tusky/EditProfileActivity.kt | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/EditProfileActivity.kt b/app/src/main/java/com/keylesspalace/tusky/EditProfileActivity.kt index 2fa1d3ae7..2e7695aba 100644 --- a/app/src/main/java/com/keylesspalace/tusky/EditProfileActivity.kt +++ b/app/src/main/java/com/keylesspalace/tusky/EditProfileActivity.kt @@ -207,7 +207,7 @@ class EditProfileActivity : BaseActivity(), Injectable { val onBackCallback = object : OnBackPressedCallback(enabled = true) { override fun handleOnBackPressed() { - if (!viewModel.hasUnsavedChanges(gatherProfileData())) finish() + if (!viewModel.hasUnsavedChanges(profileData)) finish() lifecycleScope.launch { when (showConfirmationDialog()) { @@ -224,16 +224,17 @@ class EditProfileActivity : BaseActivity(), Injectable { override fun onStop() { super.onStop() if (!isFinishing) { - viewModel.updateProfile(gatherProfileData()) + viewModel.updateProfile(profileData) } } - private fun gatherProfileData() = ProfileData( - displayName = binding.displayNameEditText.text.toString(), - note = binding.noteEditText.text.toString(), - locked = binding.lockedCheckBox.isChecked, - fields = accountFieldEditAdapter.getFieldData() - ) + private val profileData + get() = ProfileData( + displayName = binding.displayNameEditText.text.toString(), + note = binding.noteEditText.text.toString(), + locked = binding.lockedCheckBox.isChecked, + fields = accountFieldEditAdapter.getFieldData()) + private fun observeImage( liveData: LiveData, @@ -308,7 +309,7 @@ class EditProfileActivity : BaseActivity(), Injectable { return super.onOptionsItemSelected(item) } - private fun save() = viewModel.save(gatherProfileData()) + private fun save() = viewModel.save(profileData) private fun onSaveFailure(msg: String?) { val errorMsg = msg ?: getString(R.string.error_media_upload_sending)