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

Commit 1c29cb5b authored by Daniel Norman's avatar Daniel Norman
Browse files

Fixes A11yMenu Settings title bar cutoff for largest font sizes.

The ActionBar in a standard preference page uses a hardcoded size that
isn't friendly to large font size, so this change grabs the action bar
and its parent and sets WRAP_CONTENT for their height so that they grow
to accomodate the height of the TextView.

Bug: 347911378
Flag: com.android.systemui.accessibility.accessibilitymenu.action_bar_wrap_content
Test: See bug for screenshots
Change-Id: I0a6f7d6be8641983890d6d5471a89ff51194d996
parent cd3621fb
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -19,3 +19,13 @@ flag {
        purpose: PURPOSE_BUGFIX
    }
}

flag {
    name: "action_bar_wrap_content"
    namespace: "accessibility"
    description: "Applies WRAP_CONTENT to the action bar in A11yMenu settings to better fit large fonts"
    bug: "347911378"
    metadata {
        purpose: PURPOSE_BUGFIX
    }
}
+14 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import android.os.Bundle;
import android.provider.Browser;
import android.provider.Settings;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.window.OnBackInvokedCallback;

@@ -35,6 +36,7 @@ import androidx.preference.Preference;
import androidx.preference.PreferenceFragmentCompat;
import androidx.preference.PreferenceManager;

import com.android.systemui.accessibility.accessibilitymenu.Flags;
import com.android.systemui.accessibility.accessibilitymenu.R;

/**
@@ -60,6 +62,18 @@ public class A11yMenuSettingsActivity extends FragmentActivity {
        ((TextView) findViewById(R.id.action_bar_title)).setText(
                getResources().getString(R.string.accessibility_menu_settings_name)
        );
        if (Flags.actionBarWrapContent()) {
            setHeightWrapContent(findViewById(com.android.internal.R.id.action_bar));
            setHeightWrapContent(findViewById(com.android.internal.R.id.action_bar_container));
        }
    }

    private void setHeightWrapContent(View view) {
        if (view != null) {
            ViewGroup.LayoutParams params = view.getLayoutParams();
            params.height = ViewGroup.LayoutParams.WRAP_CONTENT;
            view.setLayoutParams(params);
        }
    }

    @Override