Skip to content

Commit 29eef83

Browse files
fix(detekt): Split method to stay below 60 LoC
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
1 parent 6a6d4d2 commit 29eef83

1 file changed

Lines changed: 16 additions & 9 deletions

File tree

app/src/main/java/com/nextcloud/talk/profile/ProfileActivity.kt

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,14 @@ class ProfileActivity : BaseActivity() {
368368
}
369369

370370
private fun showUserProfile() {
371+
updateProfileHeader()
372+
isProfileEnabled = "1" == userInfo?.profileEnabled
373+
adapter!!.setData(createUserInfoDetails(userInfo))
374+
updateProfileContentVisibility()
375+
updateAvatarButtonsVisibility()
376+
}
377+
378+
private fun updateProfileHeader() {
371379
if (currentUser!!.baseUrl != null) {
372380
binding.userinfoBaseurl.text = currentUser!!.baseUrl!!.toUri().host
373381
}
@@ -376,10 +384,10 @@ class ProfileActivity : BaseActivity() {
376384
binding.userinfoFullName.text = userInfo?.displayName
377385
}
378386
binding.loadingContent.visibility = View.VISIBLE
387+
}
379388

380-
isProfileEnabled = "1" == userInfo?.profileEnabled
381-
382-
adapter!!.setData(createUserInfoDetails(userInfo))
389+
private fun updateProfileContentVisibility() {
390+
val profileEnabledVisibility = if (edit) View.VISIBLE else View.GONE
383391
if (
384392
isAllEmpty(
385393
arrayOf(
@@ -400,7 +408,7 @@ class ProfileActivity : BaseActivity() {
400408
)
401409
) {
402410
binding.userinfoList.visibility = View.GONE
403-
binding.profileSettingEnabledProfile.visibility = if (edit) View.VISIBLE else View.GONE
411+
binding.profileSettingEnabledProfile.visibility = profileEnabledVisibility
404412
binding.loadingContent.visibility = View.GONE
405413
binding.emptyList.root.visibility = View.VISIBLE
406414
setErrorMessageForMultiList(
@@ -411,13 +419,12 @@ class ProfileActivity : BaseActivity() {
411419
} else {
412420
binding.emptyList.root.visibility = View.GONE
413421
binding.loadingContent.visibility = View.GONE
414-
binding.profileSettingEnabledProfile.visibility = if (edit) {
415-
View.VISIBLE
416-
} else {
417-
View.GONE
418-
}
422+
binding.profileSettingEnabledProfile.visibility = profileEnabledVisibility
419423
binding.userinfoList.visibility = View.VISIBLE
420424
}
425+
}
426+
427+
private fun updateAvatarButtonsVisibility() {
421428
binding.avatarButtons.visibility = if (edit &&
422429
CapabilitiesUtil.hasSpreedFeatureCapability(
423430
currentUser?.capabilities?.spreedCapability,

0 commit comments

Comments
 (0)