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

Dark theme support #72

Closed
xz-dev opened this issue Sep 16, 2020 · 6 comments
Closed

Dark theme support #72

xz-dev opened this issue Sep 16, 2020 · 6 comments
Milestone

Comments

@xz-dev
Copy link

xz-dev commented Sep 16, 2020

I use Application to setting my app as README saying.
But when the System Theme has changed to dark/light theme, my app will not auto change theme.
If I do not set Application and just use LocalizationApplication, my app won't go wrong.

@DanielNovak
Copy link

I can confirm I am seeing the same issue - changing to dark mode will relaunch the activities, but the dark mode is not enabled. Restarting the process will fix it. I had my own language switching code and it has the same issue as this library...

@DanielNovak
Copy link

I found the issue in your code:


You can't create the Configuration instance this way. You need to use Configuration() and only set the Locale. You only need to specify the values you would like to modify. The javadoc explains is:

/**
* Return a new Context object for the current Context but whose resources
* are adjusted to match the given Configuration. Each call to this method
* returns a new instance of a Context object; Context objects are not
* shared, however common state (ClassLoader, other Resources for the
* same configuration) may be so the Context itself can be fairly lightweight.
*
* @param overrideConfiguration A {@link Configuration} specifying what
* values to modify in the base Configuration of the original Context's
* resources. If the base configuration changes (such as due to an
* orientation change), the resources of this context will also change except
* for those that have been explicitly overridden with a value here.
*
* @return A {@link Context} with the given configuration override.
*/
public abstract Context createConfigurationContext(
@nonnull Configuration overrideConfiguration);

@akexorcist
Copy link
Owner

akexorcist commented Feb 24, 2021

From @DanielNovak suggestion. 32095d8 and 3a35ade gonna be solve this problem

But I have to do the full testing before release this because there're a lot of changes from these code.

@juliocbcotta
Copy link

From @DanielNovak suggestion. 32095d8 and 3a35ade gonna be solve this problem

But I have to do the full testing before release this because there're a lot of changes from these code.

Do you plan in releasing a new version soon ? Or at least an alpha or snapshot?

@akexorcist
Copy link
Owner

@BugsBunnyBR Yes, soon.

But if you want to try the early release version. Try JitPack

// build.gradle (project)
allprojects {
    repositories {
        /* ... */
	maven { url 'https://jitpack.io' }
    }
}

// build.gradle (app: module)
dependencies {
    /* ... */
    implementation 'com.github.akexorcist:Localization:develop-SNAPSHOT'
}

@akexorcist
Copy link
Owner

@xz-dev @DanielNovak @BugsBunnyBR Good news, 1.2.7 is rolling out

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants