Fixed
Status Update
Comments
ap...@google.com <ap...@google.com> #2
[Comment deleted]
is...@google.com <is...@google.com>
da...@google.com <da...@google.com>
na...@google.com <na...@google.com> #3
We're still trying to work out if we can work around this in the library.
In the mean-time, if you know that you are going to create a WebView in an Activity, you can do the following:
protected void onCreate(Bundle savedInstanceState) {
if (Build.VERSION.SDK_INT >= 24) {
new WebView(this);
}
super.onCreate(savedInstanceState);
}
In the mean-time, if you know that you are going to create a WebView in an Activity, you can do the following:
protected void onCreate(Bundle savedInstanceState) {
if (Build.VERSION.SDK_INT >= 24) {
new WebView(this);
}
super.onCreate(savedInstanceState);
}
pe...@gmail.com <pe...@gmail.com> #4
alternatively you were able to get it to work by capturing the configuration prior to inflating a webview and restoring it after
Configuration oldConfig = getCurrentConfig();
//**inflate webview here**
restoreConfig(oldConfig);
Configuration getCurrentConfig() {
return new Configuration(activity.getResources().getConfiguration());
}
void restoreConfig(@Nullable Configuration configuration) {
//if the config isn't null, a webview was inflated and we should update the configuration to
//the previous one to prevent nightmode from being reset by webview inflation
if (configuration != null) {
activity.getResources().updateConfiguration(configuration, null);
}
}
Configuration oldConfig = getCurrentConfig();
//**inflate webview here**
restoreConfig(oldConfig);
Configuration getCurrentConfig() {
return new Configuration(activity.getResources().getConfiguration());
}
void restoreConfig(@Nullable Configuration configuration) {
//if the config isn't null, a webview was inflated and we should update the configuration to
//the previous one to prevent nightmode from being reset by webview inflation
if (configuration != null) {
activity.getResources().updateConfiguration(configuration, null);
}
}
da...@google.com <da...@google.com> #5
#3: That can work, but you don't want to do that on EVERY WebView inflate, only the first. My workaround is #2 is a one-time call.
pe...@gmail.com <pe...@gmail.com> #6
We have webviews in recycler view. Until we wrapped every call we would get zebra stripping on recycling. Thanks for looking into issue overall!
mi...@gmail.com <mi...@gmail.com> #7
Any updates or more details on this Issue?
We were stuck for a few days trying to implement DayNight via AppCompat within our app. On API 24+ our Main activity, which hosts a ViewPager, was not being properly themed. We had inconsistent behavior on the inner fragments within the view pager hosting recycler views where they were either not themed for night mode or some items where partially getting themed. It was not until I found this issue that I was able to connect the dots as our ViewPage hosts a WebView within one of the fragments.
After adding the work around for the onCreate, we are now able to take advantage of this Support Lib feature but would like to know more about what is going on and what should we watch out moving forward. Specially as we have some devices already running Android O beta and the night theme for reasons unknown yet was not applied to some textviews.
further details are much appreciated.
We were stuck for a few days trying to implement DayNight via AppCompat within our app. On API 24+ our Main activity, which hosts a ViewPager, was not being properly themed. We had inconsistent behavior on the inner fragments within the view pager hosting recycler views where they were either not themed for night mode or some items where partially getting themed. It was not until I found this issue that I was able to connect the dots as our ViewPage hosts a WebView within one of the fragments.
After adding the work around for the onCreate, we are now able to take advantage of this Support Lib feature but would like to know more about what is going on and what should we watch out moving forward. Specially as we have some devices already running Android O beta and the night theme for reasons unknown yet was not applied to some textviews.
further details are much appreciated.
el...@google.com <el...@google.com> #8
Howdy, we can also confirm that the issue was fixed until we looked at O Preview where our tab bars are not applying night theme to the fonts. We can submit screenshots/apks if that helps.
ap...@google.com <ap...@google.com> #9
Alan - is this resource flushing that is bypassed on O?
Description