WIP: change sp to dp to ignore system wide font size preference #115

Closed
eUgEntOptIc44 wants to merge 2 commits from eUgEntOptIc44:eugentoptic44-change-sp-to-dp into master

Hi @starfish, @rz

This PR is meant to fix #114.

According to this source: https://stackoverflow.com/a/21546897.
Changing sp to dp (density-independent pixels -> docs) should ignore the system wide font size preferences.

If not then this code might fix it:

@Override
protected void attachBaseContext(Context newBase) {
    
    final Configuration override = new Configuration(newBase.getResources().getConfiguration());
    override.fontScale = 1.0f;
    applyOverrideConfiguration(override);

    super.attachBaseContext(newBase);
}

Source: https://stackoverflow.com/a/57225687

As the title suggests this is WIP as I'm currently unable to test any of this due to resource conflicts.

This PR is just the result of a short StackOverflow search and not based on technical knowhow at all. Would love to see more people looking into this.

Regards, Jean-Luc

Hi @starfish, @rz This PR is meant to fix #114. According to this source: https://stackoverflow.com/a/21546897. Changing `sp` to `dp` (*density-independent pixels* -> [docs](https://developer.android.com/training/multiscreen/screendensities.html#TaskUseDP)) should ignore the system wide **font size** preferences. If not then this code might fix it: ```java @Override protected void attachBaseContext(Context newBase) { final Configuration override = new Configuration(newBase.getResources().getConfiguration()); override.fontScale = 1.0f; applyOverrideConfiguration(override); super.attachBaseContext(newBase); } ``` Source: https://stackoverflow.com/a/57225687 As the title suggests this is WIP as I'm currently unable to test any of this due to resource conflicts. This PR is just the result of a short StackOverflow search and not based on technical knowhow at all. Would love to see more people looking into this. Regards, Jean-Luc
eUgEntOptIc44 added 1 commit 1 year ago
eUgEntOptIc44 added 1 commit 1 year ago
Poster

seems to be resolved in #114

seems to be resolved in #114
eUgEntOptIc44 closed this pull request 1 year ago
Owner

@eUgEntOptIc44 no need to override code, I can simply change sp to dp in the dimens.xml. This way, it takes effect everywhere (widgets, etc.).

@eUgEntOptIc44 no need to override code, I can simply change sp to dp in the dimens.xml. This way, it takes effect everywhere (widgets, etc.).
This pull request cannot be reopened because the branch was deleted.
You can also view command line instructions.

Step 1:

From your project repository, check out a new branch and test the changes.
git checkout -b eUgEntOptIc44-eugentoptic44-change-sp-to-dp master
git pull eugentoptic44-change-sp-to-dp

Step 2:

Merge the changes and update on Forgejo.
git checkout master
git merge --no-ff eUgEntOptIc44-eugentoptic44-change-sp-to-dp
git push origin master
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: Starfish/TinyWeatherForecastGermany#115
Loading…
There is no content yet.