1 /*
2  * Copyright (C) 2022 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  */
17 
18 package com.android.systemui.animation.view
19 
20 import android.content.Context
21 import android.util.AttributeSet
22 import android.widget.ImageView
23 import com.android.systemui.animation.LaunchableView
24 import com.android.systemui.animation.LaunchableViewDelegate
25 
26 /** An [ImageView] that also implements [LaunchableView]. */
27 open class LaunchableImageView : ImageView, LaunchableView {
28     private val delegate =
29         LaunchableViewDelegate(
30             this,
<lambda>null31             superSetVisibility = { super.setVisibility(it) },
32         )
33 
34     constructor(context: Context?) : super(context)
35     constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs)
36     constructor(
37         context: Context?,
38         attrs: AttributeSet?,
39         defStyleAttr: Int,
40     ) : super(context, attrs, defStyleAttr)
41 
42     constructor(
43         context: Context?,
44         attrs: AttributeSet?,
45         defStyleAttr: Int,
46         defStyleRes: Int,
47     ) : super(context, attrs, defStyleAttr, defStyleRes)
48 
setShouldBlockVisibilityChangesnull49     override fun setShouldBlockVisibilityChanges(block: Boolean) {
50         delegate.setShouldBlockVisibilityChanges(block)
51     }
52 
setVisibilitynull53     override fun setVisibility(visibility: Int) {
54         delegate.setVisibility(visibility)
55     }
56 }
57