Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 88fed15c authored by Tracy Zhou's avatar Tracy Zhou Committed by Android (Google) Code Review
Browse files

Merge "Footer button colors in fallback mode." into main

parents f4cf1860 608fb427
Loading
Loading
Loading
Loading
+25 −9
Original line number Diff line number Diff line
@@ -67,6 +67,7 @@ public class FooterView extends StackScrollerDecorView {
    private FooterViewButton mSettingsButton;
    private FooterViewButton mHistoryButton;
    private boolean mShouldBeHidden;
    private boolean mIsBlurSupported;

    // Footer label
    private TextView mSeenNotifsFooterTextView;
@@ -390,6 +391,7 @@ public class FooterView extends StackScrollerDecorView {

        if (!notificationFooterBackgroundTintOptimization()) {
            if (notificationShadeBlur()) {
                if (mIsBlurSupported) {
                    Color backgroundColor = Color.valueOf(
                            SurfaceEffectColors.surfaceEffect1(getContext()));
                    scHigh = ColorUtils.setAlphaComponent(backgroundColor.toArgb(), 0xFF);
@@ -400,6 +402,10 @@ public class FooterView extends StackScrollerDecorView {
                    if (historyBg != null) {
                        historyBg.setAlpha(backgroundAlpha);
                    }
                } else {
                    scHigh = mContext.getColor(
                            com.android.internal.R.color.materialColorSurfaceContainer);
                }
            } else {
                scHigh = mContext.getColor(
                        com.android.internal.R.color.materialColorSurfaceContainerHigh);
@@ -438,6 +444,16 @@ public class FooterView extends StackScrollerDecorView {
        }
    }

    public void setIsBlurSupported(boolean isBlurSupported) {
        if (notificationShadeBlur()) {
            if (mIsBlurSupported == isBlurSupported) {
                return;
            }
            mIsBlurSupported = isBlurSupported;
            updateColors();
        }
    }

    @Override
    @NonNull
    public ExpandableViewState createExpandableViewState() {
+9 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.view.View
import androidx.lifecycle.lifecycleScope
import com.android.app.tracing.coroutines.launchTraced as launch
import com.android.internal.jank.InteractionJankMonitor
import com.android.systemui.Flags.notificationShadeBlur
import com.android.systemui.lifecycle.repeatWhenAttached
import com.android.systemui.statusbar.notification.NotificationActivityStarter
import com.android.systemui.statusbar.notification.NotificationActivityStarter.SettingsIntent
@@ -81,6 +82,14 @@ object FooterViewBinder {
            launch { bindHistoryButton(footer, viewModel, notificationActivityStarter) }
        }
        launch { bindMessage(footer, viewModel) }

        if (notificationShadeBlur()) {
            launch {
                viewModel.isBlurSupported.collect { supported ->
                    footer.setIsBlurSupported(supported)
                }
            }
        }
    }

    private suspend fun bindClearAllButton(
+4 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import com.android.systemui.util.kotlin.sample
import com.android.systemui.util.ui.AnimatableEvent
import com.android.systemui.util.ui.AnimatedValue
import com.android.systemui.util.ui.toAnimatedValueFlow
import com.android.systemui.window.domain.interactor.WindowRootViewBlurInteractor
import dagger.assisted.AssistedFactory
import dagger.assisted.AssistedInject
import kotlinx.coroutines.flow.Flow
@@ -48,6 +49,7 @@ constructor(
    notificationSettingsInteractor: NotificationSettingsInteractor,
    seenNotificationsInteractor: SeenNotificationsInteractor,
    shadeInteractor: ShadeInteractor,
    windowRootViewBlurInteractor: WindowRootViewBlurInteractor,
) {
    /** A message to show instead of the footer buttons. */
    val message: FooterMessageViewModel =
@@ -119,6 +121,8 @@ constructor(
        }
    }

    val isBlurSupported = windowRootViewBlurInteractor.isBlurCurrentlySupported

    private val manageOrHistoryButtonText: Flow<Int> =
        notificationSettingsInteractor.isNotificationHistoryEnabled.map { shouldLaunchHistory ->
            if (shouldLaunchHistory) R.string.manage_notifications_history_text
+2 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import com.android.systemui.shade.domain.interactor.shadeInteractor
import com.android.systemui.shared.notifications.domain.interactor.notificationSettingsInteractor
import com.android.systemui.statusbar.notification.domain.interactor.activeNotificationsInteractor
import com.android.systemui.statusbar.notification.domain.interactor.seenNotificationsInteractor
import com.android.systemui.window.domain.interactor.windowRootViewBlurInteractor

val Kosmos.footerViewModel by Fixture {
    FooterViewModel(
@@ -29,6 +30,7 @@ val Kosmos.footerViewModel by Fixture {
        notificationSettingsInteractor = notificationSettingsInteractor,
        seenNotificationsInteractor = seenNotificationsInteractor,
        shadeInteractor = shadeInteractor,
        windowRootViewBlurInteractor = windowRootViewBlurInteractor,
    )
}
val Kosmos.footerViewModelFactory: FooterViewModel.Factory by Fixture {