Fixed
Status Update
Comments
ki...@google.com <ki...@google.com>
al...@google.com <al...@google.com> #2
Duplicate of internal issue
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 45a1bc4a15b5b10d0635d79fb55df2aced5a2a4a
Author: Alan Viverette <alanv@google.com>
Date: Thu May 14 18:06:25 2020
Only apply DayNight changes to Activity-hosted delegates
Dialogs can't receive configuration change callbacks, so there's no point
in updating their configurations. They'll have to be destroyed and re-
created by their host activities. Also, dialogs were eating the changes.
Fixes: 155379937
Test: NightModeForegroundDialogTestCase and appcompat test suite
Change-Id: Ifa18d9d42268ec8821223942dc6c817ecabbed7f
A appcompat/appcompat/src/androidTest/java/androidx/appcompat/app/NightModeDialogFragment.java
A appcompat/appcompat/src/androidTest/java/androidx/appcompat/app/NightModeForegroundDialogTestCase.kt
M appcompat/appcompat/src/main/java/androidx/appcompat/app/AppCompatDelegate.java
M appcompat/appcompat/src/main/java/androidx/appcompat/app/AppCompatDelegateImpl.java
e....@gmail.com <e....@gmail.com> #3
I think, sActiveDelegates
meant "live" delegates. Anyway, now there's a mess :(
private static final ArraySet<WeakReference<AppCompatDelegate>> sActivityDelegates;
private static final Object sActivityDelegatesLock;
static void addActiveDelegate(@NonNull AppCompatDelegate delegate);
static void removeActivityDelegate(@NonNull AppCompatDelegate delegate);
private static void removeDelegateFromActives(@NonNull AppCompatDelegate toRemove);
private static void applyDayNightToActiveDelegates();
Source:
pe...@gmail.com <pe...@gmail.com> #5
Rc02 is work for me, thanks for your work!
Description
Version used: 1.2.0-rc01 and 1.3.0-alpha01
Devices/Android versions reproduced on: Emulator Pixel 3 API 29, Emulator Pixel 2 API 28, Samsung S9 API 29
Calls to AppCompatDelegate.setDefaultNightMode() don't work well on the latest AppCompat versions, but it works on the latest stable version.
Most of the time, the theme doesn't change.