Loading res/values/dimens.xml +3 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,9 @@ <dimen name="dynamic_grid_edge_margin">6dp</dimen> <dimen name="dynamic_grid_search_bar_max_width">500dp</dimen> <dimen name="dynamic_grid_search_bar_height">56dp</dimen> <!-- We want 32dp extra for the tall search bar, but 10dp comes from unwanted padding between the search bar and workspace. --> <dimen name="dynamic_grid_search_bar_height_tall">78dp</dimen> <dimen name="dynamic_grid_page_indicator_height">20dp</dimen> <dimen name="dynamic_grid_icon_drawable_padding">4dp</dimen> <dimen name="dynamic_grid_workspace_page_spacing">8dp</dimen> Loading src/com/android/launcher3/DeviceProfile.java +28 −13 Original line number Diff line number Diff line Loading @@ -90,7 +90,8 @@ public class DeviceProfile { public int hotseatCellWidthPx; public int hotseatCellHeightPx; public int hotseatIconSizePx; private int hotseatBarHeightPx; private int hotseatBarHeightNormalPx, hotseatBarHeightShortPx; private int hotseatBarHeightPx; // One of the above. // All apps public int allAppsNumCols; Loading @@ -101,7 +102,9 @@ public class DeviceProfile { // QSB private int searchBarSpaceWidthPx; private int searchBarSpaceHeightPx; private int searchBarSpaceHeightNormalPx, searchBarSpaceHeightTallPx; private int searchBarSpaceHeightPx; // One of the above. private int searchBarHeight = LauncherCallbacks.SEARCH_BAR_HEIGHT_NORMAL; public DeviceProfile(Context context, InvariantDeviceProfile inv, Point minSize, Point maxSize, Loading Loading @@ -205,8 +208,10 @@ public class DeviceProfile { // Search Bar searchBarSpaceWidthPx = Math.min(widthPx, res.getDimensionPixelSize(R.dimen.dynamic_grid_search_bar_max_width)); searchBarSpaceHeightPx = getSearchBarTopOffset() searchBarSpaceHeightNormalPx = getSearchBarTopOffset() + res.getDimensionPixelSize(R.dimen.dynamic_grid_search_bar_height); searchBarSpaceHeightTallPx = getSearchBarTopOffset() + res.getDimensionPixelSize(R.dimen.dynamic_grid_search_bar_height_tall); // Calculate the actual text height Paint textPaint = new Paint(); Loading @@ -218,7 +223,8 @@ public class DeviceProfile { dragViewScale = (iconSizePx + scaleDps) / iconSizePx; // Hotseat hotseatBarHeightPx = iconSizePx + 4 * edgeMarginPx; hotseatBarHeightNormalPx = iconSizePx + 4 * edgeMarginPx; hotseatBarHeightShortPx = iconSizePx + 2 * edgeMarginPx; hotseatCellWidthPx = iconSizePx; hotseatCellHeightPx = iconSizePx; Loading Loading @@ -259,10 +265,10 @@ public class DeviceProfile { Rect bounds = new Rect(); if (isVerticalBarLayout()) { if (isLayoutRtl) { bounds.set(availableWidthPx - searchBarSpaceHeightPx, edgeMarginPx, bounds.set(availableWidthPx - searchBarSpaceHeightNormalPx, edgeMarginPx, availableWidthPx, availableHeightPx - edgeMarginPx); } else { bounds.set(0, edgeMarginPx, searchBarSpaceHeightPx, bounds.set(0, edgeMarginPx, searchBarSpaceHeightNormalPx, availableHeightPx - edgeMarginPx); } } else { Loading Loading @@ -294,11 +300,11 @@ public class DeviceProfile { if (isVerticalBarLayout()) { // Pad the left and right of the workspace with search/hotseat bar sizes if (isLayoutRtl) { padding.set(hotseatBarHeightPx, edgeMarginPx, padding.set(hotseatBarHeightNormalPx, edgeMarginPx, searchBarBounds.width(), edgeMarginPx); } else { padding.set(searchBarBounds.width(), edgeMarginPx, hotseatBarHeightPx, edgeMarginPx); hotseatBarHeightNormalPx, edgeMarginPx); } } else { if (isTablet) { Loading Loading @@ -351,7 +357,7 @@ public class DeviceProfile { // The rect returned will be extended to below the system ui that covers the workspace Rect getHotseatRect() { if (isVerticalBarLayout()) { return new Rect(availableWidthPx - hotseatBarHeightPx, 0, return new Rect(availableWidthPx - hotseatBarHeightNormalPx, 0, Integer.MAX_VALUE, availableHeightPx); } else { return new Rect(0, availableHeightPx - hotseatBarHeightPx, Loading @@ -367,8 +373,9 @@ public class DeviceProfile { } /** * When {@code true}, hotseat is on the bottom row when in landscape mode. * If {@code false}, hotseat is on the right column when in landscape mode. * When {@code true}, the device is in landscape mode and the hotseat is on the right column. * When {@code false}, either device is in portrait mode or the device is in landscape mode and * the hotseat is on the bottom row. */ boolean isVerticalBarLayout() { return isLandscape && transposeLayoutWithOrientation; Loading Loading @@ -396,11 +403,19 @@ public class DeviceProfile { // Layout the search bar space View searchBar = launcher.getSearchDropTargetBar(); lp = (FrameLayout.LayoutParams) searchBar.getLayoutParams(); searchBarHeight = launcher.getSearchBarHeight(); if (searchBarHeight == LauncherCallbacks.SEARCH_BAR_HEIGHT_TALL) { hotseatBarHeightPx = hotseatBarHeightShortPx; searchBarSpaceHeightPx = searchBarSpaceHeightTallPx; } else { hotseatBarHeightPx = hotseatBarHeightNormalPx; searchBarSpaceHeightPx = searchBarSpaceHeightNormalPx; } if (hasVerticalBarLayout) { // Vertical search bar space -- The search bar is fixed in the layout to be on the left // of the screen regardless of RTL lp.gravity = Gravity.LEFT; lp.width = searchBarSpaceHeightPx; lp.width = searchBarSpaceHeightNormalPx; LinearLayout targets = (LinearLayout) searchBar.findViewById(R.id.drag_target_bar); targets.setOrientation(LinearLayout.VERTICAL); Loading Loading @@ -441,7 +456,7 @@ public class DeviceProfile { // Vertical hotseat -- The hotseat is fixed in the layout to be on the right of the // screen regardless of RTL lp.gravity = Gravity.RIGHT; lp.width = hotseatBarHeightPx; lp.width = hotseatBarHeightNormalPx; lp.height = LayoutParams.MATCH_PARENT; hotseat.findViewById(R.id.layout).setPadding(0, 2 * edgeMarginPx, 0, 2 * edgeMarginPx); } else if (isTablet) { Loading src/com/android/launcher3/Launcher.java +7 −0 Original line number Diff line number Diff line Loading @@ -4137,6 +4137,13 @@ public class Launcher extends Activity return mDeviceProfile.getSearchBarBounds(Utilities.isRtl(getResources())); } public int getSearchBarHeight() { if (mLauncherCallbacks != null) { return mLauncherCallbacks.getSearchBarHeight(); } return LauncherCallbacks.SEARCH_BAR_HEIGHT_NORMAL; } public void bindSearchProviderChanged() { if (mSearchDropTargetBar == null) { return; Loading src/com/android/launcher3/LauncherCallbacks.java +3 −0 Original line number Diff line number Diff line Loading @@ -99,6 +99,9 @@ public interface LauncherCallbacks { public boolean isLauncherPreinstalled(); public AllAppsSearchBarController getAllAppsSearchBarController(); public List<ComponentKey> getPredictedApps(); public static final int SEARCH_BAR_HEIGHT_NORMAL = 0, SEARCH_BAR_HEIGHT_TALL = 1; /** Must return one of {@link #SEARCH_BAR_HEIGHT_NORMAL} or {@link #SEARCH_BAR_HEIGHT_TALL} */ public int getSearchBarHeight(); /** * Returning true will immediately result in a call to {@link #setLauncherOverlayView(ViewGroup, Loading src/com/android/launcher3/testing/LauncherExtension.java +5 −0 Original line number Diff line number Diff line Loading @@ -302,6 +302,11 @@ public class LauncherExtension extends Launcher { return new ArrayList<>(); } @Override public int getSearchBarHeight() { return SEARCH_BAR_HEIGHT_NORMAL; } @Override public boolean isLauncherPreinstalled() { return false; Loading Loading
res/values/dimens.xml +3 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,9 @@ <dimen name="dynamic_grid_edge_margin">6dp</dimen> <dimen name="dynamic_grid_search_bar_max_width">500dp</dimen> <dimen name="dynamic_grid_search_bar_height">56dp</dimen> <!-- We want 32dp extra for the tall search bar, but 10dp comes from unwanted padding between the search bar and workspace. --> <dimen name="dynamic_grid_search_bar_height_tall">78dp</dimen> <dimen name="dynamic_grid_page_indicator_height">20dp</dimen> <dimen name="dynamic_grid_icon_drawable_padding">4dp</dimen> <dimen name="dynamic_grid_workspace_page_spacing">8dp</dimen> Loading
src/com/android/launcher3/DeviceProfile.java +28 −13 Original line number Diff line number Diff line Loading @@ -90,7 +90,8 @@ public class DeviceProfile { public int hotseatCellWidthPx; public int hotseatCellHeightPx; public int hotseatIconSizePx; private int hotseatBarHeightPx; private int hotseatBarHeightNormalPx, hotseatBarHeightShortPx; private int hotseatBarHeightPx; // One of the above. // All apps public int allAppsNumCols; Loading @@ -101,7 +102,9 @@ public class DeviceProfile { // QSB private int searchBarSpaceWidthPx; private int searchBarSpaceHeightPx; private int searchBarSpaceHeightNormalPx, searchBarSpaceHeightTallPx; private int searchBarSpaceHeightPx; // One of the above. private int searchBarHeight = LauncherCallbacks.SEARCH_BAR_HEIGHT_NORMAL; public DeviceProfile(Context context, InvariantDeviceProfile inv, Point minSize, Point maxSize, Loading Loading @@ -205,8 +208,10 @@ public class DeviceProfile { // Search Bar searchBarSpaceWidthPx = Math.min(widthPx, res.getDimensionPixelSize(R.dimen.dynamic_grid_search_bar_max_width)); searchBarSpaceHeightPx = getSearchBarTopOffset() searchBarSpaceHeightNormalPx = getSearchBarTopOffset() + res.getDimensionPixelSize(R.dimen.dynamic_grid_search_bar_height); searchBarSpaceHeightTallPx = getSearchBarTopOffset() + res.getDimensionPixelSize(R.dimen.dynamic_grid_search_bar_height_tall); // Calculate the actual text height Paint textPaint = new Paint(); Loading @@ -218,7 +223,8 @@ public class DeviceProfile { dragViewScale = (iconSizePx + scaleDps) / iconSizePx; // Hotseat hotseatBarHeightPx = iconSizePx + 4 * edgeMarginPx; hotseatBarHeightNormalPx = iconSizePx + 4 * edgeMarginPx; hotseatBarHeightShortPx = iconSizePx + 2 * edgeMarginPx; hotseatCellWidthPx = iconSizePx; hotseatCellHeightPx = iconSizePx; Loading Loading @@ -259,10 +265,10 @@ public class DeviceProfile { Rect bounds = new Rect(); if (isVerticalBarLayout()) { if (isLayoutRtl) { bounds.set(availableWidthPx - searchBarSpaceHeightPx, edgeMarginPx, bounds.set(availableWidthPx - searchBarSpaceHeightNormalPx, edgeMarginPx, availableWidthPx, availableHeightPx - edgeMarginPx); } else { bounds.set(0, edgeMarginPx, searchBarSpaceHeightPx, bounds.set(0, edgeMarginPx, searchBarSpaceHeightNormalPx, availableHeightPx - edgeMarginPx); } } else { Loading Loading @@ -294,11 +300,11 @@ public class DeviceProfile { if (isVerticalBarLayout()) { // Pad the left and right of the workspace with search/hotseat bar sizes if (isLayoutRtl) { padding.set(hotseatBarHeightPx, edgeMarginPx, padding.set(hotseatBarHeightNormalPx, edgeMarginPx, searchBarBounds.width(), edgeMarginPx); } else { padding.set(searchBarBounds.width(), edgeMarginPx, hotseatBarHeightPx, edgeMarginPx); hotseatBarHeightNormalPx, edgeMarginPx); } } else { if (isTablet) { Loading Loading @@ -351,7 +357,7 @@ public class DeviceProfile { // The rect returned will be extended to below the system ui that covers the workspace Rect getHotseatRect() { if (isVerticalBarLayout()) { return new Rect(availableWidthPx - hotseatBarHeightPx, 0, return new Rect(availableWidthPx - hotseatBarHeightNormalPx, 0, Integer.MAX_VALUE, availableHeightPx); } else { return new Rect(0, availableHeightPx - hotseatBarHeightPx, Loading @@ -367,8 +373,9 @@ public class DeviceProfile { } /** * When {@code true}, hotseat is on the bottom row when in landscape mode. * If {@code false}, hotseat is on the right column when in landscape mode. * When {@code true}, the device is in landscape mode and the hotseat is on the right column. * When {@code false}, either device is in portrait mode or the device is in landscape mode and * the hotseat is on the bottom row. */ boolean isVerticalBarLayout() { return isLandscape && transposeLayoutWithOrientation; Loading Loading @@ -396,11 +403,19 @@ public class DeviceProfile { // Layout the search bar space View searchBar = launcher.getSearchDropTargetBar(); lp = (FrameLayout.LayoutParams) searchBar.getLayoutParams(); searchBarHeight = launcher.getSearchBarHeight(); if (searchBarHeight == LauncherCallbacks.SEARCH_BAR_HEIGHT_TALL) { hotseatBarHeightPx = hotseatBarHeightShortPx; searchBarSpaceHeightPx = searchBarSpaceHeightTallPx; } else { hotseatBarHeightPx = hotseatBarHeightNormalPx; searchBarSpaceHeightPx = searchBarSpaceHeightNormalPx; } if (hasVerticalBarLayout) { // Vertical search bar space -- The search bar is fixed in the layout to be on the left // of the screen regardless of RTL lp.gravity = Gravity.LEFT; lp.width = searchBarSpaceHeightPx; lp.width = searchBarSpaceHeightNormalPx; LinearLayout targets = (LinearLayout) searchBar.findViewById(R.id.drag_target_bar); targets.setOrientation(LinearLayout.VERTICAL); Loading Loading @@ -441,7 +456,7 @@ public class DeviceProfile { // Vertical hotseat -- The hotseat is fixed in the layout to be on the right of the // screen regardless of RTL lp.gravity = Gravity.RIGHT; lp.width = hotseatBarHeightPx; lp.width = hotseatBarHeightNormalPx; lp.height = LayoutParams.MATCH_PARENT; hotseat.findViewById(R.id.layout).setPadding(0, 2 * edgeMarginPx, 0, 2 * edgeMarginPx); } else if (isTablet) { Loading
src/com/android/launcher3/Launcher.java +7 −0 Original line number Diff line number Diff line Loading @@ -4137,6 +4137,13 @@ public class Launcher extends Activity return mDeviceProfile.getSearchBarBounds(Utilities.isRtl(getResources())); } public int getSearchBarHeight() { if (mLauncherCallbacks != null) { return mLauncherCallbacks.getSearchBarHeight(); } return LauncherCallbacks.SEARCH_BAR_HEIGHT_NORMAL; } public void bindSearchProviderChanged() { if (mSearchDropTargetBar == null) { return; Loading
src/com/android/launcher3/LauncherCallbacks.java +3 −0 Original line number Diff line number Diff line Loading @@ -99,6 +99,9 @@ public interface LauncherCallbacks { public boolean isLauncherPreinstalled(); public AllAppsSearchBarController getAllAppsSearchBarController(); public List<ComponentKey> getPredictedApps(); public static final int SEARCH_BAR_HEIGHT_NORMAL = 0, SEARCH_BAR_HEIGHT_TALL = 1; /** Must return one of {@link #SEARCH_BAR_HEIGHT_NORMAL} or {@link #SEARCH_BAR_HEIGHT_TALL} */ public int getSearchBarHeight(); /** * Returning true will immediately result in a call to {@link #setLauncherOverlayView(ViewGroup, Loading
src/com/android/launcher3/testing/LauncherExtension.java +5 −0 Original line number Diff line number Diff line Loading @@ -302,6 +302,11 @@ public class LauncherExtension extends Launcher { return new ArrayList<>(); } @Override public int getSearchBarHeight() { return SEARCH_BAR_HEIGHT_NORMAL; } @Override public boolean isLauncherPreinstalled() { return false; Loading