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

Commit 1baad2d8 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Adds LongPressHandlingView to KeyguardRootView." into main

parents fb287c58 00f10864
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -89,8 +89,9 @@ class LongPressHandlingView(
    }

    @SuppressLint("ClickableViewAccessibility")
    override fun onTouchEvent(event: MotionEvent?): Boolean {
        return interactionHandler.onTouchEvent(event?.toModel())
    override fun onTouchEvent(event: MotionEvent): Boolean {
        super.onTouchEvent(event)
        return interactionHandler.onTouchEvent(event.toModel())
    }
}

+1 −1
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ import androidx.constraintlayout.widget.ConstraintSet.BOTTOM
import androidx.constraintlayout.widget.ConstraintSet.END
import androidx.constraintlayout.widget.ConstraintSet.PARENT_ID
import com.android.systemui.R
import com.android.systemui.keyguard.data.repository.KeyguardSection
import com.android.systemui.keyguard.shared.model.KeyguardSection
import javax.inject.Inject

class DefaultCommunalWidgetSection @Inject constructor() : KeyguardSection {
+33 −3
Original line number Diff line number Diff line
@@ -24,6 +24,8 @@ import com.android.keyguard.KeyguardStatusViewController
import com.android.keyguard.dagger.KeyguardStatusViewComponent
import com.android.systemui.CoreStartable
import com.android.systemui.R
import com.android.systemui.animation.view.LaunchableLinearLayout
import com.android.systemui.common.ui.view.LongPressHandlingView
import com.android.systemui.communal.ui.adapter.CommunalWidgetViewAdapter
import com.android.systemui.communal.ui.binder.CommunalWidgetViewBinder
import com.android.systemui.communal.ui.viewmodel.CommunalWidgetViewModel
@@ -34,6 +36,7 @@ import com.android.systemui.keyguard.domain.interactor.KeyguardBlueprintInteract
import com.android.systemui.keyguard.ui.binder.KeyguardAmbientIndicationAreaViewBinder
import com.android.systemui.keyguard.ui.binder.KeyguardBlueprintViewBinder
import com.android.systemui.keyguard.ui.binder.KeyguardIndicationAreaBinder
import com.android.systemui.keyguard.ui.binder.KeyguardLongPressViewBinder
import com.android.systemui.keyguard.ui.binder.KeyguardQuickAffordanceViewBinder
import com.android.systemui.keyguard.ui.binder.KeyguardRootViewBinder
import com.android.systemui.keyguard.ui.binder.KeyguardSettingsViewBinder
@@ -42,6 +45,7 @@ import com.android.systemui.keyguard.ui.view.layout.KeyguardBlueprintCommandList
import com.android.systemui.keyguard.ui.viewmodel.KeyguardAmbientIndicationViewModel
import com.android.systemui.keyguard.ui.viewmodel.KeyguardBlueprintViewModel
import com.android.systemui.keyguard.ui.viewmodel.KeyguardIndicationAreaViewModel
import com.android.systemui.keyguard.ui.viewmodel.KeyguardLongPressViewModel
import com.android.systemui.keyguard.ui.viewmodel.KeyguardQuickAffordancesCombinedViewModel
import com.android.systemui.keyguard.ui.viewmodel.KeyguardRootViewModel
import com.android.systemui.keyguard.ui.viewmodel.KeyguardSettingsMenuViewModel
@@ -80,6 +84,7 @@ constructor(
    private val falsingManager: FalsingManager,
    private val vibratorHelper: VibratorHelper,
    private val keyguardStateController: KeyguardStateController,
    private val keyguardLongPressViewModel: KeyguardLongPressViewModel,
    private val keyguardSettingsMenuViewModel: KeyguardSettingsMenuViewModel,
    private val activityStarter: ActivityStarter,
    private val occludingAppDeviceEntryMessageViewModel: OccludingAppDeviceEntryMessageViewModel,
@@ -112,7 +117,7 @@ constructor(
        bindLeftShortcut()
        bindRightShortcut()
        bindAmbientIndicationArea()
        bindSettingsPopupMenu()
        bindSettingsPopupMenu(notificationPanel)
        bindCommunalWidgetArea()

        KeyguardBlueprintViewBinder.bind(keyguardRootView, keyguardBlueprintViewModel)
@@ -202,12 +207,34 @@ constructor(
        }
    }

    private fun bindSettingsPopupMenu() {
    private fun bindSettingsPopupMenu(legacyParent: ViewGroup) {
        if (featureFlags.isEnabled(Flags.MIGRATE_SPLIT_KEYGUARD_BOTTOM_AREA)) {
            // Remove the legacy long-press view from the NotificationPanelView where it used to be
            // before this refactor such that we only have one long-press view at the bottom of
            // KeyguardRootView.
            val legacyLongPressView = legacyParent.requireViewById<View>(R.id.keyguard_long_press)
            legacyParent.removeView(legacyLongPressView)

            val longPressView: LongPressHandlingView =
                keyguardRootView.requireViewById(R.id.keyguard_long_press)
            val settingsMenuView: LaunchableLinearLayout =
                keyguardRootView.requireViewById(R.id.keyguard_settings_button)

            // Bind the long-press view that (1) triggers the showing of the settings popup menu and
            // (2) captures touch events outside of the shown settings popup menu to hide it.
            KeyguardLongPressViewBinder.bind(
                view = longPressView,
                viewModel = keyguardLongPressViewModel,
                onSingleTap = {},
                falsingManager = falsingManager,
                settingsMenuView = settingsMenuView,
            )

            // Bind the settings popup menu.
            settingsPopupMenuHandle?.dispose()
            settingsPopupMenuHandle =
                KeyguardSettingsViewBinder.bind(
                    keyguardRootView,
                    settingsMenuView,
                    keyguardSettingsMenuViewModel,
                    vibratorHelper,
                    activityStarter,
@@ -216,6 +243,9 @@ constructor(
            keyguardRootView.findViewById<View?>(R.id.keyguard_settings_button)?.let {
                keyguardRootView.removeView(it)
            }
            keyguardRootView.findViewById<View?>(R.id.keyguard_long_press)?.let {
                keyguardRootView.removeView(it)
            }
        }
    }

+0 −8
Original line number Diff line number Diff line
@@ -110,11 +110,3 @@ interface KeyguardBlueprint {
            .forEach { constraintSet.setVisibility(it, View.GONE) }
    }
}

/**
 * Lower level modules that determine constraints for a particular section in the lockscreen root
 * view.
 */
interface KeyguardSection {
    fun apply(constraintSet: ConstraintSet)
}
+27 −0
Original line number Diff line number Diff line
/*
 * Copyright 2023 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.systemui.keyguard.shared.model

import androidx.constraintlayout.widget.ConstraintSet

/**
 * Lower level modules that determine constraints for a particular section in the lockscreen root
 * view.
 */
interface KeyguardSection {
    fun apply(constraintSet: ConstraintSet)
}
Loading