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

Commit 6448d375 authored by Ioana Alexandru's avatar Ioana Alexandru Committed by Android (Google) Code Review
Browse files

Merge "Handle footer visibility in the new stack." into main

parents 70eb6511 890c64d2
Loading
Loading
Loading
Loading
+0 −48
Original line number Original line Diff line number Diff line
@@ -24,17 +24,12 @@ import androidx.annotation.DimenRes
import androidx.annotation.LayoutRes
import androidx.annotation.LayoutRes
import com.android.settingslib.Utils
import com.android.settingslib.Utils
import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.lifecycle.repeatWhenAttached
import com.android.systemui.statusbar.policy.ConfigurationController
import com.android.systemui.statusbar.policy.ConfigurationController
import com.android.systemui.statusbar.policy.onDensityOrFontScaleChanged
import com.android.systemui.statusbar.policy.onDensityOrFontScaleChanged
import com.android.systemui.statusbar.policy.onThemeChanged
import com.android.systemui.statusbar.policy.onThemeChanged
import com.android.systemui.util.kotlin.emitOnStart
import com.android.systemui.util.kotlin.emitOnStart
import com.android.systemui.util.view.bindLatest
import javax.inject.Inject
import javax.inject.Inject
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.DisposableHandle
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flowOn
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.merge
import kotlinx.coroutines.flow.merge


@@ -91,46 +86,3 @@ constructor(
            .map { layoutInflater.inflate(id, root, attachToRoot) as T }
            .map { layoutInflater.inflate(id, root, attachToRoot) as T }
    }
    }
}
}

/**
 * Perform an inflation right away, then re-inflate whenever the device configuration changes, and
 * call [onInflate] on the resulting view each time. Disposes of the [DisposableHandle] returned by
 * [onInflate] when done.
 *
 * This never completes unless cancelled, it just suspends and waits for updates. It runs on a
 * background thread using [backgroundDispatcher].
 *
 * For parameters [resource], [root] and [attachToRoot], see [LayoutInflater.inflate].
 *
 * An example use-case of this is when a view needs to be re-inflated whenever a configuration
 * change occurs, which would require the ViewBinder to then re-bind the new view. For example, the
 * code in the parent view's binder would look like:
 * ```
 * parentView.repeatWhenAttached {
 *     configurationState
 *         .reinflateAndBindLatest(
 *             R.layout.my_layout,
 *             parentView,
 *             attachToRoot = false,
 *             coroutineScope = lifecycleScope,
 *             configurationController.onThemeChanged,
 *         ) { view: ChildView ->
 *             ChildViewBinder.bind(view, childViewModel)
 *         }
 * }
 * ```
 *
 * In turn, the bind method (passed through [onInflate]) uses [repeatWhenAttached], which returns a
 * [DisposableHandle].
 */
suspend fun <T : View> ConfigurationState.reinflateAndBindLatest(
    @LayoutRes resource: Int,
    root: ViewGroup?,
    attachToRoot: Boolean,
    backgroundDispatcher: CoroutineDispatcher,
    onInflate: (T) -> DisposableHandle?,
) {
    inflateLayout<T>(resource, root, attachToRoot)
        .flowOn(backgroundDispatcher)
        .bindLatest(onInflate)
}
+1 −1
Original line number Original line Diff line number Diff line
/*
/*
 * Copyright (C) 2023 The Android Open Source Project
 * Copyright (C) 2024 The Android Open Source Project
 *
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * you may not use this file except in compliance with the License.
+1 −1
Original line number Original line Diff line number Diff line
@@ -1348,7 +1348,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
        }
        }
        updateClockAppearance();
        updateClockAppearance();
        mQsController.updateQsState();
        mQsController.updateQsState();
        if (!KeyguardShadeMigrationNssl.isEnabled()) {
        if (!KeyguardShadeMigrationNssl.isEnabled() && !FooterViewRefactor.isEnabled()) {
            mNotificationStackScrollLayoutController.updateFooter();
            mNotificationStackScrollLayoutController.updateFooter();
        }
        }
    }
    }
+2 −2
Original line number Original line Diff line number Diff line
@@ -56,8 +56,8 @@ internal constructor(
            if (FooterViewRefactor.isEnabled) {
            if (FooterViewRefactor.isEnabled) {
                activeNotificationsInteractor.setNotifStats(notifStats)
                activeNotificationsInteractor.setNotifStats(notifStats)
            }
            }
            // TODO(b/293167744): This shouldn't be done if the footer flag is on, once the footer
            // TODO(b/293167744): This shouldn't be done if the footer flag is on, once the silent
            //  visibility is handled in the new stack.
            //  section clear action is handled in the new stack.
            controller.setNotifStats(notifStats)
            controller.setNotifStats(notifStats)
            if (NotificationIconContainerRefactor.isEnabled || FooterViewRefactor.isEnabled) {
            if (NotificationIconContainerRefactor.isEnabled || FooterViewRefactor.isEnabled) {
                renderListInteractor.setRenderedList(entries)
                renderListInteractor.setRenderedList(entries)
+1 −1
Original line number Original line Diff line number Diff line
/*
/*
 * Copyright (C) 2023 The Android Open Source Project
 * Copyright (C) 2024 The Android Open Source Project
 *
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * you may not use this file except in compliance with the License.
Loading