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

Commit 6e3d890d authored by Timi Rautamäki's avatar Timi Rautamäki Committed by Bruno Martins
Browse files

SystemUI: advanced reboot: set maxElementsWrap

Change-Id: I4be69c3683cf98ab7d681886976170cbfb4230ba
parent 349079b0
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -51,6 +51,17 @@ public class GlobalActionsPowerDialog {

        Resources res = context.getResources();

        int nElementsWrap = res.getInteger(
                com.android.systemui.R.integer.power_menu_lite_max_columns);
        int nChildren = listView.getChildCount() - 1; // don't count flow element

        // Avoid having just one action on the last row if there are more than 2 columns because
        // it looks unbalanced. Instead, bring the column size down to balance better.
        if (nChildren == nElementsWrap + 1 && nElementsWrap > 2) {
            nElementsWrap -= 1;
        }
        flow.setMaxElementsWrap(nElementsWrap);

        Dialog dialog = new Dialog(context);
        dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
        dialog.setContentView(listView);