Loading src/com/android/launcher3/DeviceProfile.java +3 −3 Original line number Diff line number Diff line Loading @@ -250,7 +250,7 @@ public class DeviceProfile { /** Returns the search bar bounds in the current orientation */ public Rect getSearchBarBounds(boolean isLayoutRtl) { Rect bounds = new Rect(); if (isLandscape && transposeLayoutWithOrientation) { if (isVerticalBarLayout()) { if (isLayoutRtl) { bounds.set(availableWidthPx - searchBarSpaceHeightPx, edgeMarginPx, availableWidthPx, availableHeightPx - edgeMarginPx); Loading Loading @@ -284,7 +284,7 @@ public class DeviceProfile { Rect getWorkspacePadding(boolean isLayoutRtl) { Rect searchBarBounds = getSearchBarBounds(isLayoutRtl); Rect padding = new Rect(); if (isLandscape && transposeLayoutWithOrientation) { if (isVerticalBarLayout()) { // Pad the left and right of the workspace with search/hotseat bar sizes if (isLayoutRtl) { padding.set(hotseatBarHeightPx, edgeMarginPx, Loading Loading @@ -320,7 +320,7 @@ public class DeviceProfile { } private int getWorkspacePageSpacing(boolean isLayoutRtl) { if ((isLandscape && transposeLayoutWithOrientation) || isLargeTablet) { if (isVerticalBarLayout() || isLargeTablet) { // In landscape mode the page spacing is set to the default. return defaultPageSpacingPx; } else { Loading src/com/android/launcher3/Launcher.java +25 −2 Original line number Diff line number Diff line Loading @@ -3561,6 +3561,28 @@ public class Launcher extends Activity opts.putInt(AppWidgetManager.OPTION_APPWIDGET_HOST_CATEGORY, AppWidgetProviderInfo.WIDGET_CATEGORY_SEARCHBOX); // Determine the min and max dimensions of the widget. LauncherAppState app = LauncherAppState.getInstance(); DeviceProfile portraitProfile = app.getInvariantDeviceProfile().portraitProfile; DeviceProfile landscapeProfile = app.getInvariantDeviceProfile().landscapeProfile; float density = getResources().getDisplayMetrics().density; Rect searchBounds = portraitProfile.getSearchBarBounds(Utilities.isRtl(getResources())); int maxHeight = (int) (searchBounds.height() / density); int minHeight = maxHeight; int maxWidth = (int) (searchBounds.width() / density); int minWidth = maxWidth; if (!landscapeProfile.isVerticalBarLayout()) { searchBounds = landscapeProfile.getSearchBarBounds(Utilities.isRtl(getResources())); maxHeight = (int) Math.max(maxHeight, searchBounds.height() / density); minHeight = (int) Math.min(minHeight, searchBounds.height() / density); maxWidth = (int) Math.max(maxWidth, searchBounds.width() / density); minWidth = (int) Math.min(minWidth, searchBounds.width() / density); } opts.putInt(AppWidgetManager.OPTION_APPWIDGET_MAX_HEIGHT, maxHeight); opts.putInt(AppWidgetManager.OPTION_APPWIDGET_MIN_HEIGHT, minHeight); opts.putInt(AppWidgetManager.OPTION_APPWIDGET_MAX_WIDTH, maxWidth); opts.putInt(AppWidgetManager.OPTION_APPWIDGET_MIN_WIDTH, minWidth); SharedPreferences sp = getSharedPreferences( LauncherAppState.getSharedPreferencesKey(), MODE_PRIVATE); int widgetId = sp.getInt(QSB_WIDGET_ID, -1); Loading Loading @@ -4177,6 +4199,7 @@ public class Launcher extends Activity return mDeviceProfile.isVerticalBarLayout(); } /** Returns the search bar bounds in pixels. */ protected Rect getSearchBarBounds() { return mDeviceProfile.getSearchBarBounds(Utilities.isRtl(getResources())); } Loading Loading
src/com/android/launcher3/DeviceProfile.java +3 −3 Original line number Diff line number Diff line Loading @@ -250,7 +250,7 @@ public class DeviceProfile { /** Returns the search bar bounds in the current orientation */ public Rect getSearchBarBounds(boolean isLayoutRtl) { Rect bounds = new Rect(); if (isLandscape && transposeLayoutWithOrientation) { if (isVerticalBarLayout()) { if (isLayoutRtl) { bounds.set(availableWidthPx - searchBarSpaceHeightPx, edgeMarginPx, availableWidthPx, availableHeightPx - edgeMarginPx); Loading Loading @@ -284,7 +284,7 @@ public class DeviceProfile { Rect getWorkspacePadding(boolean isLayoutRtl) { Rect searchBarBounds = getSearchBarBounds(isLayoutRtl); Rect padding = new Rect(); if (isLandscape && transposeLayoutWithOrientation) { if (isVerticalBarLayout()) { // Pad the left and right of the workspace with search/hotseat bar sizes if (isLayoutRtl) { padding.set(hotseatBarHeightPx, edgeMarginPx, Loading Loading @@ -320,7 +320,7 @@ public class DeviceProfile { } private int getWorkspacePageSpacing(boolean isLayoutRtl) { if ((isLandscape && transposeLayoutWithOrientation) || isLargeTablet) { if (isVerticalBarLayout() || isLargeTablet) { // In landscape mode the page spacing is set to the default. return defaultPageSpacingPx; } else { Loading
src/com/android/launcher3/Launcher.java +25 −2 Original line number Diff line number Diff line Loading @@ -3561,6 +3561,28 @@ public class Launcher extends Activity opts.putInt(AppWidgetManager.OPTION_APPWIDGET_HOST_CATEGORY, AppWidgetProviderInfo.WIDGET_CATEGORY_SEARCHBOX); // Determine the min and max dimensions of the widget. LauncherAppState app = LauncherAppState.getInstance(); DeviceProfile portraitProfile = app.getInvariantDeviceProfile().portraitProfile; DeviceProfile landscapeProfile = app.getInvariantDeviceProfile().landscapeProfile; float density = getResources().getDisplayMetrics().density; Rect searchBounds = portraitProfile.getSearchBarBounds(Utilities.isRtl(getResources())); int maxHeight = (int) (searchBounds.height() / density); int minHeight = maxHeight; int maxWidth = (int) (searchBounds.width() / density); int minWidth = maxWidth; if (!landscapeProfile.isVerticalBarLayout()) { searchBounds = landscapeProfile.getSearchBarBounds(Utilities.isRtl(getResources())); maxHeight = (int) Math.max(maxHeight, searchBounds.height() / density); minHeight = (int) Math.min(minHeight, searchBounds.height() / density); maxWidth = (int) Math.max(maxWidth, searchBounds.width() / density); minWidth = (int) Math.min(minWidth, searchBounds.width() / density); } opts.putInt(AppWidgetManager.OPTION_APPWIDGET_MAX_HEIGHT, maxHeight); opts.putInt(AppWidgetManager.OPTION_APPWIDGET_MIN_HEIGHT, minHeight); opts.putInt(AppWidgetManager.OPTION_APPWIDGET_MAX_WIDTH, maxWidth); opts.putInt(AppWidgetManager.OPTION_APPWIDGET_MIN_WIDTH, minWidth); SharedPreferences sp = getSharedPreferences( LauncherAppState.getSharedPreferencesKey(), MODE_PRIVATE); int widgetId = sp.getInt(QSB_WIDGET_ID, -1); Loading Loading @@ -4177,6 +4199,7 @@ public class Launcher extends Activity return mDeviceProfile.isVerticalBarLayout(); } /** Returns the search bar bounds in pixels. */ protected Rect getSearchBarBounds() { return mDeviceProfile.getSearchBarBounds(Utilities.isRtl(getResources())); } Loading