diff --git a/CHANGES.md b/CHANGES.md index 1bde8a7dfd..ca35023ede 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -10,6 +10,7 @@ Improvements 🙌: Bugfix 🐛: - Display name not shown under Settings/General (#1926) - Fix changing language issue + - Fix FontSize issue (#1483, #1787) Translations 🗣: - diff --git a/vector/src/main/java/im/vector/app/core/platform/VectorBaseActivity.kt b/vector/src/main/java/im/vector/app/core/platform/VectorBaseActivity.kt index 856e84ea14..bedb02949f 100644 --- a/vector/src/main/java/im/vector/app/core/platform/VectorBaseActivity.kt +++ b/vector/src/main/java/im/vector/app/core/platform/VectorBaseActivity.kt @@ -76,6 +76,7 @@ import im.vector.app.features.rageshake.BugReportActivity import im.vector.app.features.rageshake.BugReporter import im.vector.app.features.rageshake.RageShake import im.vector.app.features.session.SessionListener +import im.vector.app.features.settings.FontScale import im.vector.app.features.settings.VectorPreferences import im.vector.app.features.themes.ActivityOtherThemes import im.vector.app.features.themes.ThemeUtils @@ -219,6 +220,9 @@ abstract class VectorBaseActivity : AppCompatActivity(), HasScreenInjector { doBeforeSetContentView() + // Hack for font size + applyFontSize() + if (getLayoutRes() != -1) { setContentView(getLayoutRes()) } @@ -239,6 +243,16 @@ abstract class VectorBaseActivity : AppCompatActivity(), HasScreenInjector { } } + /** + * This method has to be called for the font size setting be supported correctly. + */ + private fun applyFontSize() { + resources.configuration.fontScale = FontScale.getFontScaleValue(this).scale + + @Suppress("DEPRECATION") + resources.updateConfiguration(resources.configuration, resources.displayMetrics) + } + private fun handleGlobalError(globalError: GlobalError) { when (globalError) { is GlobalError.InvalidToken -> @@ -302,10 +316,10 @@ abstract class VectorBaseActivity : AppCompatActivity(), HasScreenInjector { super.onActivityResult(requestCode, resultCode, data) if (requestCode == PinActivity.PIN_REQUEST_CODE) { when (resultCode) { - Activity.RESULT_OK -> { + Activity.RESULT_OK -> { pinLocker.unlock() } - else -> { + else -> { pinLocker.block() moveTaskToBack(true) }