1 /* 2 * Copyright (C) 2017 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.content.Context; 19 import android.util.AttributeSet; 20 import android.view.WindowInsets; 21 22 import com.android.launcher3.Launcher; 23 import com.android.launcher3.LauncherState; 24 import com.android.launcher3.Utilities; 25 26 /** 27 * AllAppsContainerView with launcher specific callbacks 28 */ 29 public class LauncherAllAppsContainerView extends ActivityAllAppsContainerView<Launcher> { 30 LauncherAllAppsContainerView(Context context)31 public LauncherAllAppsContainerView(Context context) { 32 this(context, null); 33 } 34 LauncherAllAppsContainerView(Context context, AttributeSet attrs)35 public LauncherAllAppsContainerView(Context context, AttributeSet attrs) { 36 this(context, attrs, 0); 37 } 38 LauncherAllAppsContainerView(Context context, AttributeSet attrs, int defStyleAttr)39 public LauncherAllAppsContainerView(Context context, AttributeSet attrs, int defStyleAttr) { 40 super(context, attrs, defStyleAttr); 41 } 42 43 @Override computeNavBarScrimHeight(WindowInsets insets)44 protected int computeNavBarScrimHeight(WindowInsets insets) { 45 if (Utilities.ATLEAST_Q) { 46 return insets.getTappableElementInsets().bottom; 47 } else { 48 return insets.getStableInsetBottom(); 49 } 50 } 51 52 @Override isInAllApps()53 public boolean isInAllApps() { 54 return mActivityContext.getStateManager().isInStableState(LauncherState.ALL_APPS); 55 } 56 } 57