chinwag-android/app/src/main/res/values/attrs.xml
Nik Clayton fe7b1529df
Provide a preference to scale all UI text (#3248)
Font scaling is applied in addition to any scaling set in Android system preferences. So if the user set the Android font size to largest (a 1.3x increase) and then sets the preference to 120%, the total change is 1.56x.

Create SliderPreference to adjust the preference.

- Use Slider, which supports float values and step sizes > 1
- Display the selected value in the preference's summary
- Provide buttons to increment / decrement the value

Restart the activity if the preference changes so that the user sees the impact of the change immediately. Fix a bug in PreferencesActivity where the "EXTRA_RESTART_ON_BACK" intent was never processed. Fix this to ensure that other activities are restarted so the new font scale takes effect.

Implement the scaling in BaseActivity by overriding onAttachBaseContext, and providing a wrapped context with the font scaling applied.

Fixes https://github.com/tuskyapp/Tusky/issues/2982, https://github.com/tuskyapp/Tusky/issues/2461
2023-06-29 18:34:56 +02:00

48 lines
2 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="ClickableSpanTextView">
<!-- Necessary to support tools:text in Android Studio layout designer -->
<attr name="android:text"/>
</declare-styleable>
<declare-styleable name="LicenseCard">
<attr name="name" format="string|reference" />
<attr name="license" format="string|reference" />
<attr name="link" format="string|reference" />
<attr name="description" format="string|reference" />
</declare-styleable>
<declare-styleable name="GraphView">
<attr name="primaryLineColor" format="reference|color" />
<attr name="secondaryLineColor" format="reference|color" />
<attr name="lineWidth" format="dimension" />
<attr name="graphColor" format="reference|color" />
<attr name="metaColor" format="reference|color" />
<attr name="proportionalTrending" format="boolean" />
</declare-styleable>
<declare-styleable name="SliderPreference">
<attr name="android:value" format="string|reference" />
<attr name="android:valueFrom" format="string|reference" />
<attr name="android:valueTo" format="string|reference" />
<attr name="android:stepSize" format="string|reference" />
<attr name="format" format="string|reference" />
<attr name="iconStart" format="reference" />
<attr name="iconEnd" format="reference" />
</declare-styleable>
<!--Themed Attributes-->
<attr name="colorBackgroundAccent" format="reference|color" />
<attr name="colorBackgroundHighlight" format="reference|color" />
<attr name="textColorDisabled" format="reference|color" />
<attr name="iconColor" format="reference|color" />
<attr name="windowBackgroundColor" format="reference|color" />
<attr name="dividerColor" format="reference|color" />
<attr name="status_text_small" format="dimension" />
<attr name="status_text_medium" format="dimension" />
<attr name="status_text_large" format="dimension" />
</resources>