• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2014 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 package com.android.systemui.statusbar;
18 
19 import android.content.Context;
20 import android.util.AttributeSet;
21 import android.widget.FrameLayout;
22 
23 import com.android.systemui.animation.LaunchableView;
24 import com.android.systemui.animation.LaunchableViewDelegate;
25 
26 import kotlin.Unit;
27 
28 /**
29  * A frame layout which does not have overlapping renderings commands and therefore does not need a
30  * layer when alpha is changed.
31  */
32 public class AlphaOptimizedFrameLayout extends FrameLayout implements LaunchableView
33 {
34     private final LaunchableViewDelegate mLaunchableViewDelegate = new LaunchableViewDelegate(
35             this,
36             visibility -> {
37                 super.setVisibility(visibility);
38                 return Unit.INSTANCE;
39             });
40 
AlphaOptimizedFrameLayout(Context context)41     public AlphaOptimizedFrameLayout(Context context) {
42         super(context);
43     }
44 
AlphaOptimizedFrameLayout(Context context, AttributeSet attrs)45     public AlphaOptimizedFrameLayout(Context context, AttributeSet attrs) {
46         super(context, attrs);
47     }
48 
AlphaOptimizedFrameLayout(Context context, AttributeSet attrs, int defStyleAttr)49     public AlphaOptimizedFrameLayout(Context context, AttributeSet attrs, int defStyleAttr) {
50         super(context, attrs, defStyleAttr);
51     }
52 
AlphaOptimizedFrameLayout(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)53     public AlphaOptimizedFrameLayout(Context context, AttributeSet attrs, int defStyleAttr,
54             int defStyleRes) {
55         super(context, attrs, defStyleAttr, defStyleRes);
56     }
57 
58     @Override
hasOverlappingRendering()59     public boolean hasOverlappingRendering() {
60         return false;
61     }
62 
63     @Override
setShouldBlockVisibilityChanges(boolean block)64     public void setShouldBlockVisibilityChanges(boolean block) {
65         mLaunchableViewDelegate.setShouldBlockVisibilityChanges(block);
66     }
67 
68     @Override
setVisibility(int visibility)69     public void setVisibility(int visibility) {
70         mLaunchableViewDelegate.setVisibility(visibility);
71     }
72 }
73