Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit eef44324 authored by Tony Wickham's avatar Tony Wickham
Browse files

Set search bar height before setting up views in Launcher.

This ensures that the QSB widget options are set correctly the first
time they are used.

Bug: 24704753
Change-Id: I2bb13ff012b6f13ca076deed61f0b08a7037e2fa
parent 93229c40
Loading
Loading
Loading
Loading
+11 −9
Original line number Original line Diff line number Diff line
@@ -104,7 +104,6 @@ public class DeviceProfile {
    private int searchBarSpaceWidthPx;
    private int searchBarSpaceWidthPx;
    private int searchBarSpaceHeightNormalPx, searchBarSpaceHeightTallPx;
    private int searchBarSpaceHeightNormalPx, searchBarSpaceHeightTallPx;
    private int searchBarSpaceHeightPx; // One of the above.
    private int searchBarSpaceHeightPx; // One of the above.
    private int searchBarHeight = LauncherCallbacks.SEARCH_BAR_HEIGHT_NORMAL;


    public DeviceProfile(Context context, InvariantDeviceProfile inv,
    public DeviceProfile(Context context, InvariantDeviceProfile inv,
            Point minSize, Point maxSize,
            Point minSize, Point maxSize,
@@ -396,6 +395,17 @@ public class DeviceProfile {
        return visibleChildren;
        return visibleChildren;
    }
    }


    // TODO(twickham): b/25154513
    public void setSearchBarHeight(int searchBarHeight) {
        if (searchBarHeight == LauncherCallbacks.SEARCH_BAR_HEIGHT_TALL) {
            hotseatBarHeightPx = hotseatBarHeightShortPx;
            searchBarSpaceHeightPx = searchBarSpaceHeightTallPx;
        } else {
            hotseatBarHeightPx = hotseatBarHeightNormalPx;
            searchBarSpaceHeightPx = searchBarSpaceHeightNormalPx;
        }
    }

    public void layout(Launcher launcher) {
    public void layout(Launcher launcher) {
        FrameLayout.LayoutParams lp;
        FrameLayout.LayoutParams lp;
        boolean hasVerticalBarLayout = isVerticalBarLayout();
        boolean hasVerticalBarLayout = isVerticalBarLayout();
@@ -404,14 +414,6 @@ public class DeviceProfile {
        // Layout the search bar space
        // Layout the search bar space
        View searchBar = launcher.getSearchDropTargetBar();
        View searchBar = launcher.getSearchDropTargetBar();
        lp = (FrameLayout.LayoutParams) searchBar.getLayoutParams();
        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) {
        if (hasVerticalBarLayout) {
            // Vertical search bar space -- The search bar is fixed in the layout to be on the left
            // Vertical search bar space -- The search bar is fixed in the layout to be on the left
            //                              of the screen regardless of RTL
            //                              of the screen regardless of RTL
+6 −0
Original line number Original line Diff line number Diff line
@@ -454,6 +454,8 @@ public class Launcher extends Activity


        setContentView(R.layout.launcher);
        setContentView(R.layout.launcher);


        app.getInvariantDeviceProfile().landscapeProfile.setSearchBarHeight(getSearchBarHeight());
        app.getInvariantDeviceProfile().portraitProfile.setSearchBarHeight(getSearchBarHeight());
        setupViews();
        setupViews();
        mDeviceProfile.layout(this);
        mDeviceProfile.layout(this);


@@ -3630,6 +3632,10 @@ public class Launcher extends Activity
            opts.putInt(AppWidgetManager.OPTION_APPWIDGET_MIN_HEIGHT, minHeight);
            opts.putInt(AppWidgetManager.OPTION_APPWIDGET_MIN_HEIGHT, minHeight);
            opts.putInt(AppWidgetManager.OPTION_APPWIDGET_MAX_WIDTH, maxWidth);
            opts.putInt(AppWidgetManager.OPTION_APPWIDGET_MAX_WIDTH, maxWidth);
            opts.putInt(AppWidgetManager.OPTION_APPWIDGET_MIN_WIDTH, minWidth);
            opts.putInt(AppWidgetManager.OPTION_APPWIDGET_MIN_WIDTH, minWidth);
            if (LOGD) {
                Log.d(TAG, "QSB widget options: maxHeight=" + maxHeight + " minHeight=" + minHeight
                        + " maxWidth=" + maxWidth + " minWidth=" + minWidth);
            }


            if (mLauncherCallbacks != null) {
            if (mLauncherCallbacks != null) {
                opts.putAll(mLauncherCallbacks.getAdditionalSearchWidgetOptions());
                opts.putAll(mLauncherCallbacks.getAdditionalSearchWidgetOptions());