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 17 package com.android.launcher3.uioverrides; 18 19 import android.app.Person; 20 import android.content.Context; 21 import android.content.pm.ShortcutInfo; 22 import android.content.res.Resources; 23 import android.view.Display; 24 25 import com.android.launcher3.R; 26 import com.android.launcher3.Utilities; 27 import com.android.quickstep.SysUINavigationMode; 28 import com.android.quickstep.SysUINavigationMode.Mode; 29 30 public class ApiWrapper { 31 32 public static final boolean TASKBAR_DRAWN_IN_PROCESS = true; 33 getPersons(ShortcutInfo si)34 public static Person[] getPersons(ShortcutInfo si) { 35 Person[] persons = si.getPersons(); 36 return persons == null ? Utilities.EMPTY_PERSON_ARRAY : persons; 37 } 38 39 /** 40 * Returns true if the display is an internal displays 41 */ isInternalDisplay(Display display)42 public static boolean isInternalDisplay(Display display) { 43 return display.getType() == Display.TYPE_INTERNAL; 44 } 45 46 /** 47 * Returns a unique ID representing the display 48 */ getUniqueId(Display display)49 public static String getUniqueId(Display display) { 50 return display.getUniqueId(); 51 } 52 53 /** 54 * Returns the minimum space that should be left empty at the end of hotseat 55 */ getHotseatEndOffset(Context context)56 public static int getHotseatEndOffset(Context context) { 57 if (SysUINavigationMode.INSTANCE.get(context).getMode() == Mode.THREE_BUTTONS) { 58 Resources res = context.getResources(); 59 /* 60 * 3 nav buttons + 61 * Little space at the end for contextual buttons + 62 * Little space between icons and nav buttons 63 */ 64 return 3 * res.getDimensionPixelSize(R.dimen.taskbar_nav_buttons_size) 65 + res.getDimensionPixelSize(R.dimen.taskbar_contextual_button_margin) 66 + res.getDimensionPixelSize(R.dimen.taskbar_hotseat_nav_spacing); 67 } else { 68 return 0; 69 } 70 71 } 72 } 73