Fix activity relaunches constantly on WSA (#1721)

Fix #1711
This commit is contained in:
LoveSy 2022-02-25 06:59:56 +08:00 committed by GitHub
parent 3701033061
commit 71dd8f07a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -196,9 +196,11 @@ public class App extends Application {
@SuppressWarnings("deprecation")
@Override
public void onConfigurationChanged(@NonNull Configuration newConfig) {
LocaleDelegate.setDefaultLocale(getLocale());
newConfig.setLocale(getLocale());
getResources().updateConfiguration(newConfig, getResources().getDisplayMetrics());
if (getResources().getConfiguration().diff(newConfig) != 0) {
LocaleDelegate.setDefaultLocale(getLocale());
newConfig.setLocale(getLocale());
getResources().updateConfiguration(newConfig, getResources().getDisplayMetrics());
}
super.onConfigurationChanged(newConfig);
}