MaximBelov opened a new pull request, #1167:
URL: https://github.com/apache/cordova-plugin-inappbrowser/pull/1167

   ### Platforms affected
   Android
   
   ### Motivation and Context
   The InAppBrowser has no way to set its background colour on Android, which 
shows up in two ways.
   
   The one people notice is the flash on open: the window appears, shows the 
device theme background for a second or two while the first page loads, then 
the page paints over it. That is black on most devices and white on emulators, 
which is what #1075 was about. The `hidden` + `loadstop` workaround suggested 
there hides the browser instead of fixing the colour, and the reporter said 
they still caught a glimpse of black.
   
   The other is #501, open since 2019: a page that doesn't paint its own 
background (an image, a transparent body) has no way to control what shows 
behind it.
   
   iOS already handles this, `CDVWKInAppBrowser.m` sets 
`webView.backgroundColor` to white and `opaque = YES`, so the platforms 
currently behave differently for the same call.
   
   Closes #501
   Refs #1075
   
   ### Description
   Adds a `backgroundcolor` option, taking the same hex string format as the 
existing `toolbarcolor` and `footercolor` (`#rrggbb` or `#aarrggbb`).
   
   It is applied in two places:
   
   - the root `LinearLayout`, which is what actually removes the flash. The 
WebView doesn't draw anything until it has painted its first frame, so before 
that you are looking at the dialog window background through an unpainted 
layout. Setting it only on the WebView, as I first tried, doesn't help.
   - the WebView itself, matching what iOS does, which covers pages that don't 
paint their own background.
   
   `BACKGROUND_COLOR` is registered in `customizableOptions`. Without that, 
`parseFeature` rewrites any value that isn't `yes`/`no` to `"yes"`, and 
`Color.parseColor("yes")` would throw.
   
   Default behaviour is unchanged: if the option isn't passed, nothing is set 
and the browser looks exactly as it does today. I deliberately didn't default 
it to white for iOS parity, since that would be a visual change for every 
existing app. Happy to make that the default instead if you would prefer the 
platforms to match out of the box.
   
   Independent of #1073, they touch different parts of the same method and can 
merge in either order.
   
   ### Testing
   Compiles against cordova-android 14 / SDK 35, `npm test` passes.
   
   Manual verification on a device is still outstanding, which is why this is a 
draft. What needs checking: open with `backgroundcolor=#ffffff` on a 
dark-themed device and confirm the black flash is gone, then confirm no visible 
change at all when the option is omitted.
   
   ### Checklist
   
   - [x] I've run the tests to see all new and existing tests pass
   - [ ] I added automated test coverage as appropriate for this change
   - [x] Commit is prefixed with `(platform)` if this change only applies to 
one platform (e.g. `(android)`)
   - [x] If this Pull Request resolves an issue, I linked to the issue in the 
text above (and used the correct [keyword to close issues using 
keywords](https://help.github.com/articles/closing-issues-using-keywords/))
   - [x] I've updated the documentation if necessary
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to