Hi guys, I've found an issue with proposed solution related to SplashMaintainAspectRatio=true option - it seems that there's no straightforward way to support this option for Activity background drawable. So for SplashMaintainAspectRatio=true there will be a subtle size change on start up. Possible solutions are 1) to resize and crop Bitmap in platform code and 2) to add splash screen layout to the app as a layer (and then hide/show it). Both of the options look overcomplicated for me though.
Alternative variant is to set the activity background only for the case of SplashMaintainAspectRatio=false (this is the default value) to (partially) solve the original issue with flicker and document this as a quirk. What do you think? Please let me know if you have any questions or considerations. Best regards, Sergey Shakhnazarov. On Tue, Dec 27, 2016 at 5:34 PM, Sergey Shakhnazarov <dase...@apache.org> wrote: > Hi Joe, guys, happy holidays everyone! > > Regarding "this is not a problem unique to PhoneGap/Cordova" - I've > attached short videos to the Jira [1] with the flicker issue clearly > visible for a blank Cordova app (build with latest published versions of > cordova, cordova-android and cordova-plugin-splashscreen), recorded Youtube > app launch where flicker does not appear and also uploaded launch videos > with this patch applied (with default cordova logo, transparent and > non-transparent splash images). > > I've updated the branches and sent PRs [2], [3] and I believe the change > is no more breaking - it is a minor bump. > Added some checks and tested cases when we have old plugin or platform > versions. > Splash background will be now defined as SplashScreenBackgroundColor -> > BackgroundColor -> BLACK (-> means fallback here). > The only case which might break people is project upgrade when we have a > new platform and an old plugin version - in this case if you use > SplashScreenBackgroundColor, there will be a color change from it on start > to BackgroundColor (or BLACK if it's not defined) when splash screen > activity is shown. > I've added a CLI warning for this case so that people could see the reason > of this issue. > Note that it should not actually occur since if a developer starts to use > SplashScreenBackgroundColor explicitly, he will also use an updated plugin > version. > > [1]: https://issues.apache.org/jira/browse/CB-12099 > [2]: https://github.com/apache/cordova-android/pull/354 > [3]: https://github.com/apache/cordova-plugin-splashscreen/pull/121 > > Please let me know if you have any questions or considerations. > > Best regards, > Sergey Shakhnazarov. > > On Wed, Dec 21, 2016 at 12:37 AM, Joe Bowser <bows...@gmail.com> wrote: > >> Comments are inline >> >> On Tue, Dec 20, 2016 at 1:19 PM, Sergey Shakhnazarov <dase...@apache.org> >> wrote: >>> >>> >>> > 3. I'm not sure why we need the prepare step and why the drawable's >>> colour can't be changed programmatically in Java instead of pulling it >>> from >>> the config.xml in prepare.js, which isn't guaranteed to work in earlier >>> versions of Cordova. >>> Yes we can change the bg color programmatically but it will be too late >>> as >>> there will be a visible color change from initial color defined in >>> layout. >>> >>> >> Then we really shouldn't be adding this. I don't think that this issue >> is serious enough to warrant a major version change right now. Perhaps if >> we have a few major changes to the API that we want to make pending, we can >> then revisit it. >> >> I don't think it's possible to address "1." taking into account the >>> flicker >>> issue is reproducing even without the plugin added - there is a black >>> screen before view is being filled with BackgroundColor. >>> >>> I think I've noticed another bug right now, which occurs when we have NO >>> splashscreen plugin added - in this case there's a flash of >>> BackgroundColor >>> between app launch and webview showing. >>> >>> >> That's the webview being too slow to render, and it's existed since the >> project started. Unfortunately that can't be fixed, but only mitigated by >> using a Splashscreen and having an application that doesn't take all day to >> render. This is why the background color is a preference that you can set >> in config.xml in the first place. >> >> BTW: Every application starts out the same way on Android, and this is >> only visible if there's something slowing down or blocking the application >> from rendering (for example, when you debug the application, you will see a >> black screen with the dialog saying that the debugger is connecting). I >> know that we do some hide/show magic with the WebView itself on the >> Activity to try and prevent a white flash from appearing before the page is >> rendered, so it's possible that the application is taking too long to draw >> or the UI thread is blocked on something. I've seen Unity applications >> (OK, Just Pokemon Go, but there have to be others) crash and leave with >> just a black screen, so this is not a problem unique to PhoneGap/Cordova. >> >> Best regards, >>> Sergey. >>> >>> >>> On Sat, Dec 17, 2016 at 10:34 AM, Joe Bowser <bows...@gmail.com> wrote: >>> >>> > OK, I read the PR, and I'll admit that I misunderstood part of the >>> > problem. I have a few concerns about this change: >>> > >>> > 1. Why does Android need to have a PR at all? The splashscreen plugin >>> can >>> > use edit-config tag to change the manifest to add the theme, which it >>> > really should anyway and the XML files can be copied by the plugin.xml. >>> > 2. The bug refers to the flicker, which I haven't seen in quite a >>> while, >>> > but can be attributed to the splashscreen disappearing at the wrong >>> time >>> > and the WebView not being made visible or not rendering properly. >>> CB-12099 >>> > explicitly refers to the weird behaviour of the SplashScreenDelay not >>> > actually being followed, which is why I made my initial comment. It's >>> not >>> > its own bug, but a part of CB-12099 >>> > 3. I'm not sure why we need the prepare step and why the drawable's >>> colour >>> > can't be changed programmatically in Java instead of pulling it from >>> the >>> > config.xml in prepare.js, which isn't guaranteed to work in earlier >>> > versions of Cordova. >>> > >>> > I know this seems like more work, but I think it's possible to do this >>> > without having to change the Plugin API for Splashscreen, also doing so >>> > will also work on existing versions of Cordova, and this fix would >>> probably >>> > consist of a major version bump, because the new splashscreen wouldn't >>> work >>> > on the old versions of Cordova-Android. >>> > >>> > On Fri, Dec 16, 2016 at 10:34 PM, Sergey Shakhnazarov < >>> dase...@apache.org> >>> > wrote: >>> > >>> >> Hello Joe, >>> >> >>> >> Could you please elaborate - is there a Jira item corresponding to >>> that >>> >> duration issue? >>> >> >>> >> Thanks, >>> >> Sergey. >>> >> >>> >> 16 Дек 2016 г. 23:38 пользователь "Joe Bowser" <bows...@gmail.com> >>> >> написал: >>> >> >>> >> I think we should figure out why the duration of the Splashscreen is >>> >> messed >>> >> up before we start messing with the background colour of the >>> application, >>> >> especially since the last time we did that, we broke Hello World! >>> >> >>> >> On Fri, Dec 16, 2016 at 11:32 AM, Sergey Shakhnazarov < >>> dase...@apache.org >>> >> > >>> >> wrote: >>> >> >>> >> > Hi guys! >>> >> > >>> >> > >>> >> > >>> >> > There’s an issue with Android splashscreen that every app has a >>> black >>> >> flash >>> >> > on start [1]. >>> >> > >>> >> > I propose to fix this using the android:windowBackground composed as >>> >> splash >>> >> > image (which we use in splashscreen plugin) laid on top of >>> >> > SplashScreenBackgroundColor >>> >> > [2] (this preference is supported on Windows only as of now and >>> will be >>> >> > particularly useful for transparent images). >>> >> > >>> >> > I would appreciate any feedback on the proposal and prototype >>> >> > implementation [3, 4]. >>> >> > >>> >> > >>> >> > >>> >> > [1]: https://issues.apache.org/jira/browse/CB-12099 >>> >> > >>> >> > [2]: https://cordova.apache.org/docs/en/dev/config_ref/index.html >>> >> > >>> >> > [3]: https://github.com/daserge/cordova-android/tree/CB-12099 >>> >> > >>> >> > [4]: https://github.com/daserge/cordova-plugin-splashscreen/tree/ >>> >> CB-12099 >>> >> > >>> >> > >>> >> > >>> >> > Please let me know if you have any questions or considerations. >>> >> > >>> >> > >>> >> > Best regards, >>> >> > >>> >> > Sergey Shakhnazarov, >>> >> > >>> >> > Akvelon developer. >>> >> > >>> >> >>> > >>> > >>> >> >> >