refactor: Remove unnecessary return type from `handleProfileClick`
This commit is contained in:
parent
8c95472d42
commit
26ff8e5bad
|
@ -488,7 +488,10 @@ class MainActivity : BottomSheetActivity(), ActionButtonActivity, HasAndroidInje
|
||||||
header = AccountHeaderView(this).apply {
|
header = AccountHeaderView(this).apply {
|
||||||
headerBackgroundScaleType = ImageView.ScaleType.CENTER_CROP
|
headerBackgroundScaleType = ImageView.ScaleType.CENTER_CROP
|
||||||
currentHiddenInList = true
|
currentHiddenInList = true
|
||||||
onAccountHeaderListener = { _: View?, profile: IProfile, current: Boolean -> handleProfileClick(profile, current) }
|
onAccountHeaderListener = { _: View?, profile: IProfile, current: Boolean ->
|
||||||
|
handleProfileClick(profile, current)
|
||||||
|
false
|
||||||
|
}
|
||||||
addProfile(
|
addProfile(
|
||||||
ProfileSettingDrawerItem().apply {
|
ProfileSettingDrawerItem().apply {
|
||||||
identifier = DRAWER_ITEM_ADD_ACCOUNT
|
identifier = DRAWER_ITEM_ADD_ACCOUNT
|
||||||
|
@ -854,23 +857,23 @@ class MainActivity : BottomSheetActivity(), ActionButtonActivity, HasAndroidInje
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleProfileClick(profile: IProfile, current: Boolean): Boolean {
|
private fun handleProfileClick(profile: IProfile, current: Boolean) {
|
||||||
val activeAccount = accountManager.activeAccount
|
val activeAccount = accountManager.activeAccount
|
||||||
|
|
||||||
// open profile when active image was clicked
|
// open profile when active image was clicked
|
||||||
if (current && activeAccount != null) {
|
if (current && activeAccount != null) {
|
||||||
val intent = AccountActivity.getIntent(this, activeAccount.accountId)
|
val intent = AccountActivity.getIntent(this, activeAccount.accountId)
|
||||||
startActivityWithSlideInAnimation(intent)
|
startActivityWithSlideInAnimation(intent)
|
||||||
return false
|
return
|
||||||
}
|
}
|
||||||
// open LoginActivity to add new account
|
// open LoginActivity to add new account
|
||||||
if (profile.identifier == DRAWER_ITEM_ADD_ACCOUNT) {
|
if (profile.identifier == DRAWER_ITEM_ADD_ACCOUNT) {
|
||||||
startActivityWithSlideInAnimation(LoginActivity.getIntent(this, LoginActivity.MODE_ADDITIONAL_LOGIN))
|
startActivityWithSlideInAnimation(LoginActivity.getIntent(this, LoginActivity.MODE_ADDITIONAL_LOGIN))
|
||||||
return false
|
return
|
||||||
}
|
}
|
||||||
// change Account
|
// change Account
|
||||||
changeAccount(profile.identifier, null)
|
changeAccount(profile.identifier, null)
|
||||||
return false
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun changeAccount(newSelectedId: Long, forward: Intent?) {
|
private fun changeAccount(newSelectedId: Long, forward: Intent?) {
|
||||||
|
|
Loading…
Reference in New Issue