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

Commit c5d4ee93 authored by Sahil Sonar's avatar Sahil Sonar 💬 Committed by Saalim Quadri
Browse files

fix(folders): Fix folder icon alignment

parent a3303951
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -669,12 +669,15 @@ public class FolderIcon extends FrameLayout implements FolderListener, FloatingI
    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        if (MultiModeController.isSingleLayerMode()) {
            boolean shouldCenterIcon = mActivity.getDeviceProfile().iconCenterVertically;
            if (shouldCenterIcon) {
                int iconSize = mActivity.getDeviceProfile().iconSizePx;
                Paint.FontMetrics fm = mFolderName.getPaint().getFontMetrics();
            int cellHeightPx = mFolderName.getIconSize() + mFolderName.getCompoundDrawablePadding() +
                    (int) Math.ceil(fm.bottom - fm.top);
            int height = MeasureSpec.getSize(heightMeasureSpec);
            setPadding(getPaddingLeft(), (height - cellHeightPx) / 2, getPaddingRight(),
                    getPaddingBottom());
                int cellHeightPx = iconSize + mFolderName.getCompoundDrawablePadding()
                        + (int) Math.ceil(fm.bottom - fm.top);
                setPadding(getPaddingLeft(), (MeasureSpec.getSize(heightMeasureSpec)
                        - cellHeightPx) / 2, getPaddingRight(), getPaddingBottom());
            }
        }
        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
    }