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

Commit a64a914d authored by Thales Lima's avatar Thales Lima
Browse files

Calculate taskbar content size for edu

Using the value calculated in layout was not working because TaskbarView onLayout() was being called after TaskbarEduView onMeasure(). Now uses the same value on all orientations based on taskbar icon size.

Fixes: 252945031
Test: manual
Change-Id: Ib6914901638c82f3b3ec4c9b86f6c20e84d34d0f
parent 7c914432
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -222,7 +222,7 @@ public class TaskbarEduController implements TaskbarControllers.LoggableTaskbarC
        }

        int getIconLayoutBoundsWidth() {
            return mControllers.taskbarViewController.getIconLayoutBounds().width();
            return mControllers.taskbarViewController.getIconLayoutWidth();
        }
    }
}
+13 −5
Original line number Diff line number Diff line
@@ -321,12 +321,8 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
    @Override
    protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
        int count = getChildCount();
        int countExcludingQsb = count;
        DeviceProfile deviceProfile = mActivityContext.getDeviceProfile();
        if (deviceProfile.isQsbInline) {
            countExcludingQsb--;
        }
        int spaceNeeded = countExcludingQsb * (mItemMarginLeftRight * 2 + mIconTouchSize);
        int spaceNeeded = getIconLayoutWidth();
        int navSpaceNeeded = deviceProfile.hotseatBarEndOffset;
        boolean layoutRtl = isLayoutRtl();
        int iconEnd = right - (right - left - spaceNeeded) / 2;
@@ -416,6 +412,18 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
        return mIconLayoutBounds;
    }

    /**
     * Returns the space used by the icons
     */
    public int getIconLayoutWidth() {
        int countExcludingQsb = getChildCount();
        DeviceProfile deviceProfile = mActivityContext.getDeviceProfile();
        if (deviceProfile.isQsbInline) {
            countExcludingQsb--;
        }
        return countExcludingQsb * (mItemMarginLeftRight * 2 + mIconTouchSize);
    }

    /**
     * Returns the app icons currently shown in the taskbar.
     */
+4 −0
Original line number Diff line number Diff line
@@ -193,6 +193,10 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
        return mTaskbarView.getIconLayoutBounds();
    }

    public int getIconLayoutWidth() {
        return mTaskbarView.getIconLayoutWidth();
    }

    public View[] getIconViews() {
        return mTaskbarView.getIconViews();
    }