Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/footer/ui/viewbinder/FooterViewBinder.kt +28 −31 Original line number Diff line number Diff line Loading @@ -44,7 +44,7 @@ object FooterViewBinder { viewModel, clearAllNotifications, launchNotificationSettings, launchNotificationHistory launchNotificationHistory, ) } } Loading @@ -55,21 +55,15 @@ object FooterViewBinder { viewModel: FooterViewModel, clearAllNotifications: View.OnClickListener, launchNotificationSettings: View.OnClickListener, launchNotificationHistory: View.OnClickListener launchNotificationHistory: View.OnClickListener, ) = coroutineScope { launch { bindClearAllButton( footer, viewModel, clearAllNotifications, ) } launch { bindClearAllButton(footer, viewModel, clearAllNotifications) } launch { bindManageOrHistoryButton( footer, viewModel, launchNotificationSettings, launchNotificationHistory launchNotificationHistory, ) } launch { bindMessage(footer, viewModel) } Loading @@ -80,8 +74,6 @@ object FooterViewBinder { viewModel: FooterViewModel, clearAllNotifications: View.OnClickListener, ) = coroutineScope { footer.setClearAllButtonClickListener(clearAllNotifications) launch { viewModel.clearAllButton.labelId.collect { textId -> footer.setClearAllButtonText(textId) Loading @@ -96,18 +88,21 @@ object FooterViewBinder { launch { viewModel.clearAllButton.isVisible.collect { isVisible -> if (isVisible.value) { footer.setClearAllButtonClickListener(clearAllNotifications) } else { // When the button isn't visible, it also shouldn't react to clicks. This is // necessary because when the clear all button is not visible, it's actually // just the alpha that becomes 0 so it can still be tapped. footer.setClearAllButtonClickListener(null) } if (isVisible.isAnimating) { footer.setClearAllButtonVisible( isVisible.value, /* animate = */ true, ) { _ -> footer.setClearAllButtonVisible(isVisible.value, /* animate= */ true) { _ -> isVisible.stopAnimating() } } else { footer.setClearAllButtonVisible( isVisible.value, /* animate = */ false, ) footer.setClearAllButtonVisible(isVisible.value, /* animate= */ false) } } } Loading Loading @@ -143,22 +138,24 @@ object FooterViewBinder { launch { viewModel.manageOrHistoryButton.isVisible.collect { isVisible -> // NOTE: This visibility change is never animated. // NOTE: This visibility change is never animated. We also don't need to do anything // special about the onClickListener here, since we're changing the visibility to // GONE so it won't be clickable anyway. footer.setManageOrHistoryButtonVisible(isVisible.value) } } } private suspend fun bindMessage( footer: FooterView, viewModel: FooterViewModel, ) = coroutineScope { private suspend fun bindMessage(footer: FooterView, viewModel: FooterViewModel) = coroutineScope { // Bind the resource IDs footer.setMessageString(viewModel.message.messageId) footer.setMessageIcon(viewModel.message.iconId) launch { viewModel.message.isVisible.collect { visible -> footer.setFooterLabelVisible(visible) } viewModel.message.isVisible.collect { visible -> footer.setFooterLabelVisible(visible) } } } } Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/footer/ui/viewbinder/FooterViewBinder.kt +28 −31 Original line number Diff line number Diff line Loading @@ -44,7 +44,7 @@ object FooterViewBinder { viewModel, clearAllNotifications, launchNotificationSettings, launchNotificationHistory launchNotificationHistory, ) } } Loading @@ -55,21 +55,15 @@ object FooterViewBinder { viewModel: FooterViewModel, clearAllNotifications: View.OnClickListener, launchNotificationSettings: View.OnClickListener, launchNotificationHistory: View.OnClickListener launchNotificationHistory: View.OnClickListener, ) = coroutineScope { launch { bindClearAllButton( footer, viewModel, clearAllNotifications, ) } launch { bindClearAllButton(footer, viewModel, clearAllNotifications) } launch { bindManageOrHistoryButton( footer, viewModel, launchNotificationSettings, launchNotificationHistory launchNotificationHistory, ) } launch { bindMessage(footer, viewModel) } Loading @@ -80,8 +74,6 @@ object FooterViewBinder { viewModel: FooterViewModel, clearAllNotifications: View.OnClickListener, ) = coroutineScope { footer.setClearAllButtonClickListener(clearAllNotifications) launch { viewModel.clearAllButton.labelId.collect { textId -> footer.setClearAllButtonText(textId) Loading @@ -96,18 +88,21 @@ object FooterViewBinder { launch { viewModel.clearAllButton.isVisible.collect { isVisible -> if (isVisible.value) { footer.setClearAllButtonClickListener(clearAllNotifications) } else { // When the button isn't visible, it also shouldn't react to clicks. This is // necessary because when the clear all button is not visible, it's actually // just the alpha that becomes 0 so it can still be tapped. footer.setClearAllButtonClickListener(null) } if (isVisible.isAnimating) { footer.setClearAllButtonVisible( isVisible.value, /* animate = */ true, ) { _ -> footer.setClearAllButtonVisible(isVisible.value, /* animate= */ true) { _ -> isVisible.stopAnimating() } } else { footer.setClearAllButtonVisible( isVisible.value, /* animate = */ false, ) footer.setClearAllButtonVisible(isVisible.value, /* animate= */ false) } } } Loading Loading @@ -143,22 +138,24 @@ object FooterViewBinder { launch { viewModel.manageOrHistoryButton.isVisible.collect { isVisible -> // NOTE: This visibility change is never animated. // NOTE: This visibility change is never animated. We also don't need to do anything // special about the onClickListener here, since we're changing the visibility to // GONE so it won't be clickable anyway. footer.setManageOrHistoryButtonVisible(isVisible.value) } } } private suspend fun bindMessage( footer: FooterView, viewModel: FooterViewModel, ) = coroutineScope { private suspend fun bindMessage(footer: FooterView, viewModel: FooterViewModel) = coroutineScope { // Bind the resource IDs footer.setMessageString(viewModel.message.messageId) footer.setMessageIcon(viewModel.message.iconId) launch { viewModel.message.isVisible.collect { visible -> footer.setFooterLabelVisible(visible) } viewModel.message.isVisible.collect { visible -> footer.setFooterLabelVisible(visible) } } } }