BaseActivity: invalidate icon cache on Android P
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
e5f6c24174
commit
8aab35a70d
@ -121,6 +121,7 @@ public abstract class BaseActivity extends AppCompatActivity implements Topic.Su
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTopicPublished(Topic topic) {
|
public void onTopicPublished(Topic topic) {
|
||||||
|
if (topic == Application.getComponent().getThemeChangeTopic()) {
|
||||||
try {
|
try {
|
||||||
Field f = getResources().getClass().getDeclaredField("mResourcesImpl");
|
Field f = getResources().getClass().getDeclaredField("mResourcesImpl");
|
||||||
f.setAccessible(true);
|
f.setAccessible(true);
|
||||||
@ -128,15 +129,13 @@ public abstract class BaseActivity extends AppCompatActivity implements Topic.Su
|
|||||||
f = o.getClass().getDeclaredField("mDrawableCache");
|
f = o.getClass().getDeclaredField("mDrawableCache");
|
||||||
f.setAccessible(true);
|
f.setAccessible(true);
|
||||||
o = f.get(o);
|
o = f.get(o);
|
||||||
f = o.getClass().getSuperclass().getDeclaredField("mThemedEntries");
|
o.getClass().getMethod("onConfigurationChange", int.class).invoke(o, -1);
|
||||||
f.setAccessible(true);
|
|
||||||
o = f.get(o);
|
|
||||||
o.getClass().getMethod("clear").invoke(o);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(TAG, "Failed to flush icon cache", e);
|
Log.e(TAG, "Failed to flush icon cache", e);
|
||||||
}
|
}
|
||||||
recreate();
|
recreate();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Topic[] getSubscription() {
|
public Topic[] getSubscription() {
|
||||||
|
@ -101,6 +101,7 @@ public class SettingsActivity extends AppCompatActivity implements Topic.Subscri
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTopicPublished(final Topic topic) {
|
public void onTopicPublished(final Topic topic) {
|
||||||
|
if (topic == Application.getComponent().getThemeChangeTopic())
|
||||||
recreate();
|
recreate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user