cobaltians / Cobalt

Cobalt is a web and native framework to create mobile applications that can mix web technologies and native technologies.
http://cobaltians.org
MIT License
71 stars 14 forks source link

nativeBars - status bar visibility and color #93

Open ggendre opened 8 years ago

ggendre commented 8 years ago

Enable cobalt app developper to custom the status bar visibility and colors.

Guidelines :

On Android the background color should be dark. and darken than bars. because text color is always white.

On iOS the text color can be white or black. The background color is transparent if no bars are set and corresponds to the bars background color if bars are set.

What we could do :

Add a statusBar object in each cobalt.conf controller configuration.

statusBar : {
    visible : true/false,
    lightText : true/false
}

Default would be : visible:true, black ios text color and black android backgroud color.

The default android background color could be calculated to be darker than the specified bars color.

can be set from javascript too

As for native bars, this feature should be available from the JS side too with a function like this :

    cobalt.statusBar.set({ visible: true, lightText : false});

This is sending this message to the native side {type: "ui", control: "statusBar", data: {action: "set", bar: { visible: true, lightText : false}}}

can be set from navigation calls too

As for native bars, this feature should be available on push, replace, modal navigation calls

    cobalt.navigation.push({
       page : 'myPage.html',
       controller : 'myController',
       statusBar: {visible: true, lightText : false}
    });

Progress

Doc1faux commented 8 years ago

On iOS, default values:

ggendre commented 8 years ago

TO BE DISCUSSED : The current statusbar is over the webview on iOS. should we be able to reproduce this as well ?

capture d ecran 2016-07-05 a 17 47 01

proposed API in the issue does not allow this for the moment.

Doc1faux commented 8 years ago

We can't propose this feature while having the WebView background visible under the status bar

Myrdhinn commented 8 years ago

androidBackgroundColor is accessible only for android 5.0 Under you must change the AppTheme, https://developer.android.com/training/material/theme.html#ColorPalette

ggendre commented 8 years ago

@Doc1faux : what we could do is :

ggendre commented 8 years ago

@Myrdhinn : rename key androidBackgroundColor to backgroundColor because we will be able to use it on iOS aswell.

Doc1faux commented 8 years ago

@ggendre Mmhhhh NO! The "WebView background color" will be defined by the backgroundColor attribute of the controller defined in the cobalt.confconfiguration file as explained in issue #106. You should not have a status bar color different from the navigation bar one or the view one on iOS!

So, if the navigation bar is not present, the "WebView background" (in fact, the root view one), it should be, in this order:

If navigation bar is present, the status bar color will be the navigation bar background one.

ggendre commented 8 years ago

You are going to hate me but we need to make it possible to configure this from the JS side and in navigation calls. Added tasks for this. it could be done in a second time if needed.