1 /*
2  * Copyright (C) 2018 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.launcher3.allapps;
17 
18 import android.graphics.Rect;
19 import android.view.animation.Interpolator;
20 
21 import com.android.launcher3.DeviceProfile;
22 import com.android.launcher3.anim.PropertySetter;
23 
24 /**
25  * A abstract representation of a row in all-apps view
26  */
27 public interface FloatingHeaderRow {
28 
29     FloatingHeaderRow[] NO_ROWS = new FloatingHeaderRow[0];
30 
setup(FloatingHeaderView parent, FloatingHeaderRow[] allRows, boolean tabsHidden)31     void setup(FloatingHeaderView parent, FloatingHeaderRow[] allRows, boolean tabsHidden);
32 
setInsets(Rect insets, DeviceProfile grid)33     void setInsets(Rect insets, DeviceProfile grid);
34 
getExpectedHeight()35     int getExpectedHeight();
36 
37     /**
38      * Returns true if the row should draw based on its current position and layout.
39      */
shouldDraw()40     boolean shouldDraw();
41 
42     /**
43      * Returns true if the view has anything worth drawing. This is different than
44      * {@link #shouldDraw()} as this is called earlier in the layout to determine the view
45      * position.
46      */
hasVisibleContent()47     boolean hasVisibleContent();
48 
setContentVisibility(boolean hasHeaderExtra, boolean hasAllAppsContent, PropertySetter setter, Interpolator headerFade, Interpolator allAppsFade)49     void setContentVisibility(boolean hasHeaderExtra, boolean hasAllAppsContent,
50             PropertySetter setter, Interpolator headerFade, Interpolator allAppsFade);
51 
52     /**
53      * Scrolls the content vertically.
54      */
setVerticalScroll(int scroll, boolean isScrolledOut)55     void setVerticalScroll(int scroll, boolean isScrolledOut);
56 
getTypeClass()57     Class<? extends FloatingHeaderRow> getTypeClass();
58 }
59