Skip to content
This repository was archived by the owner on Jun 22, 2022. It is now read-only.
This repository was archived by the owner on Jun 22, 2022. It is now read-only.

Dark Mode Problem With MODE_NIGHT_FOLLOW_SYSTEM Selected #52

@berkayturanci

Description

@berkayturanci

There is an error on the library where if user want to use Dark Mode with flag MODE_NIGHT_FOLLOW_SYSTEM.

MODE_NIGHT_NO, MODE_NIGHT_YES or MODE_NIGHT_AUTO_BATTERY works fine and only problem occurs due to the selection of MODE_NIGHT_FOLLOW_SYSTEM.

Once system dark mode is changed, the application did not restarted with proper dark mode theme in MODE_NIGHT_FOLLOW_SYSTEM selected.

The problem caused due to the Application class method overriding.

Causes Error:

    @Override
    protected void attachBaseContext(Context base) {
        deviceLanguage = Util.getDeviceLanguage();
        super.attachBaseContext(localizationDelegate.attachBaseContext(base));
    }

Not Causes Error, but Language changing doesn't work in this way:

    @Override
    protected void attachBaseContext(Context base) {
        localizationDelegate.setDefaultLanguage(base, MainApp.getDeviceLanguage());
        localizationDelegate.attachBaseContext(base);
        super.attachBaseContext(base);
    }

Version: 1.2.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions