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

Commit 71572aa7 authored by Maryam Dehaini's avatar Maryam Dehaini Committed by Android (Google) Code Review
Browse files

Merge "[1/N] WindowDecor refactor: Add single listener for window decor events" into main

parents e757afdd 009bbeef
Loading
Loading
Loading
Loading
+3 −10
Original line number Diff line number Diff line
@@ -14,7 +14,8 @@
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<com.android.wm.shell.windowdecor.CaptionMenuLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
    android:id="@+id/maximize_menu"
    android:layout_width="wrap_content"
@@ -158,12 +159,4 @@
                android:alpha="0"/>
        </LinearLayout>
    </LinearLayout>

    <!-- Empty view intentionally placed in front of everything else and matching the menu size
     used to monitor input events over the entire menu. -->
    <View
        android:id="@+id/maximize_menu_overlay"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>
</FrameLayout>
</com.android.wm.shell.windowdecor.CaptionMenuLayout>
+50 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2025 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.wm.shell.windowdecor

import android.content.Context
import android.util.AttributeSet
import android.view.MotionEvent
import android.widget.FrameLayout

/**
 * View group that allows a hover listener to be set for the entire menu layout.
 */
class CaptionMenuLayout : FrameLayout {
    /** Called when menu receives hover event without consuming the event. */
    var onInterceptHoverListener: ((MotionEvent) -> Unit)? = null

    constructor(
        context: Context
    ) : super(context)

    constructor(
        context: Context,
        attrs: AttributeSet?
    ) : super(context, attrs)

    constructor(
        context: Context,
        attrs: AttributeSet?,
        defStyleAttr: Int
    ) : super(context, attrs, defStyleAttr)

    override fun onInterceptHoverEvent(ev: MotionEvent): Boolean {
        onInterceptHoverListener?.invoke(ev)
        return super.onInterceptHoverEvent(ev)
    }
}
+142 −148

File changed.

Preview size limit exceeded, changes collapsed.

+51 −144

File changed.

Preview size limit exceeded, changes collapsed.

+0 −7
Original line number Diff line number Diff line
@@ -305,13 +305,6 @@ public class DragPositioningCallbackUtility {
    }

    public interface DragEventListener {
        /**
         * Inform the implementing class that a drag resize has started
         *
         * @param taskId id of this positioner's {@link WindowDecoration}
         */
        void onDragStart(int taskId);

        /**
         * Inform the implementing class that a drag move has started.
         *
Loading