Fix FontSize issue (#1483, #1787)

This commit is contained in:
Benoit Marty 2020-08-24 18:20:09 +02:00 committed by Benoit Marty
parent 52cf4d24d3
commit cb7a1bc9c3
2 changed files with 17 additions and 2 deletions

View file

@ -10,6 +10,7 @@ Improvements 🙌:
Bugfix 🐛:
- Display name not shown under Settings/General (#1926)
- Fix changing language issue
- Fix FontSize issue (#1483, #1787)
Translations 🗣:
-

View file

@ -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)
}