• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2024 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package com.android.wm.shell.windowdecor.viewholder
17 
18 import android.app.ActivityManager.RunningTaskInfo
19 import android.content.Context
20 import android.view.View
21 import com.android.wm.shell.windowdecor.viewholder.WindowDecorationViewHolder.Data
22 
23 /**
24  * Encapsulates the root [View] of a window decoration and its children to facilitate looking up
25  * children (via findViewById) and updating to the latest data from [RunningTaskInfo].
26  */
27 abstract class WindowDecorationViewHolder<T : Data>(rootView: View) : AutoCloseable {
28   val context: Context = rootView.context
29 
30   /**
31    * A signal to the view holder that new data is available and that the views should be updated to
32    * reflect it.
33    */
bindDatanull34   abstract fun bindData(data: T)
35 
36   /** Callback when the handle menu is opened. */
37   abstract fun onHandleMenuOpened()
38 
39   /** Callback when the handle menu is closed. */
40   abstract fun onHandleMenuClosed()
41 
42   /** Callback when the window decoration is destroyed. */
43   abstract override fun close()
44 
45   /** Data clas that contains the information needed to update the view holder. */
46   abstract class Data
47 }
48