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

Commit 77163472 authored by Xiaowen Lei's avatar Xiaowen Lei Committed by Android (Google) Code Review
Browse files

Merge "Add BcSmartspaceView to keyguard bottom area." into main

parents 39cc587b 384d6ea9
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -107,4 +107,13 @@

    <include layout="@layout/ambient_indication"
             android:id="@id/ambient_indication_container" />

    <FrameLayout
        android:id="@+id/smartspace_container"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:layout_marginBottom="@dimen/ambient_indication_margin_bottom"
        android:visibility="gone">
    </FrameLayout>
</com.android.systemui.statusbar.phone.KeyguardBottomAreaView>
+5 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
import static com.android.keyguard.KeyguardClockSwitch.LARGE;
import static com.android.keyguard.KeyguardClockSwitch.SMALL;
import static com.android.systemui.Flags.migrateClocksToBlueprint;
import static com.android.systemui.Flags.smartspaceRelocateToBottom;
import static com.android.systemui.flags.Flags.LOCKSCREEN_WALLPAPER_DREAM_ENABLED;
import static com.android.systemui.util.kotlin.JavaAdapterKt.collectFlow;

@@ -421,6 +422,10 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
            return;
        }

        if (smartspaceRelocateToBottom()) {
            return;
        }

        mSmartspaceView = mSmartspaceController.buildAndConnectView(mView);
        LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
                MATCH_PARENT, WRAP_CONTENT);
+7 −1
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import static com.android.keyguard.KeyguardClockSwitch.SMALL;
import static com.android.systemui.Flags.keyguardBottomAreaRefactor;
import static com.android.systemui.Flags.migrateClocksToBlueprint;
import static com.android.systemui.Flags.predictiveBackAnimateShade;
import static com.android.systemui.Flags.smartspaceRelocateToBottom;
import static com.android.systemui.classifier.Classifier.BOUNCER_UNLOCK;
import static com.android.systemui.classifier.Classifier.GENERIC;
import static com.android.systemui.classifier.Classifier.QUICK_SETTINGS;
@@ -1428,7 +1429,12 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
            int index = mView.indexOfChild(mKeyguardBottomArea);
            mView.removeView(mKeyguardBottomArea);
            KeyguardBottomAreaView oldBottomArea = mKeyguardBottomArea;
            setKeyguardBottomArea(mKeyguardBottomAreaViewControllerProvider.get().getView());
            KeyguardBottomAreaViewController keyguardBottomAreaViewController =
                    mKeyguardBottomAreaViewControllerProvider.get();
            if (smartspaceRelocateToBottom()) {
                keyguardBottomAreaViewController.init();
            }
            setKeyguardBottomArea(keyguardBottomAreaViewController.getView());
            mKeyguardBottomArea.initFrom(oldBottomArea);
            mView.addView(mKeyguardBottomArea, index);

+41 −2
Original line number Diff line number Diff line
@@ -18,12 +18,23 @@ package com.android.systemui.statusbar.phone

import com.android.systemui.flags.FeatureFlagsClassic
import com.android.systemui.flags.Flags
import com.android.systemui.Flags.smartspaceRelocateToBottom
import android.view.View
import android.view.ViewGroup
import android.widget.LinearLayout
import com.android.systemui.res.R
import com.android.systemui.statusbar.lockscreen.LockscreenSmartspaceController
import com.android.systemui.util.ViewController
import javax.inject.Inject

class KeyguardBottomAreaViewController
    @Inject constructor(view: KeyguardBottomAreaView, featureFlags: FeatureFlagsClassic) :
    ViewController<KeyguardBottomAreaView> (view) {
    @Inject constructor(
            view: KeyguardBottomAreaView,
            private val smartspaceController: LockscreenSmartspaceController,
            featureFlags: FeatureFlagsClassic
) : ViewController<KeyguardBottomAreaView> (view) {

    private var smartspaceView: View? = null

    init {
        view.setIsLockscreenLandscapeEnabled(
@@ -31,6 +42,14 @@ class KeyguardBottomAreaViewController
    }

    override fun onViewAttached() {
        if (!smartspaceRelocateToBottom() || !smartspaceController.isEnabled()) {
            return
        }

        val ambientIndicationArea = mView.findViewById<View>(R.id.ambient_indication_container)
        ambientIndicationArea?.visibility = View.GONE

        addSmartspaceView()
    }

    override fun onViewDetached() {
@@ -40,4 +59,24 @@ class KeyguardBottomAreaViewController
        // TODO: remove this method.
        return mView
    }

    private fun addSmartspaceView() {
        if (!smartspaceRelocateToBottom()) {
            return
        }

        val smartspaceContainer = mView.findViewById<View>(R.id.smartspace_container)
        smartspaceContainer!!.visibility = View.VISIBLE

        smartspaceView = smartspaceController.buildAndConnectView(smartspaceContainer as ViewGroup)
        val lp = LinearLayout.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
        (smartspaceContainer as ViewGroup).addView(smartspaceView, 0, lp)
        val startPadding = context.resources.getDimensionPixelSize(
                R.dimen.below_clock_padding_start)
        val endPadding = context.resources.getDimensionPixelSize(
                R.dimen.below_clock_padding_end)
        smartspaceView?.setPaddingRelative(startPadding, 0, endPadding, 0)
//        mKeyguardUnlockAnimationController.lockscreenSmartspace = smartspaceView
    }
}