-
Notifications
You must be signed in to change notification settings - Fork 14
cobalt.json
This file is required to specify the views of a cobalt application, if you don't want to use the default one everywhere.
This is a JSON file that contains one key per view in a 'controllers' array. A view is basically a controller and some options for the different platforms.
{
"controllers": {
"default": {
"ios": "ViewController",
"iosNib": "ViewControllerNib",
"android": ".MyActivity",
"pullToRefresh" : true
},
"myVideoController": {
"ios": "MyVideoViewController",
"android": "com.example.myApplication.MyVideoActivity"
}
}
}
Each view, named here "controller" is defined by a few keys :
-
android (optional): The name of the Android Activity to use. You can set the full package name like
com.example.myApp.myActivity
or use the.
shortcut to start from your app package. Default is org.cobaltians.CobaltActivity. -
ios (optional): The name of the iOS Controller to use. Default is CobaltViewController.
-
iosNib (for iOS, optional): The name of the .xib file to use with the class name defined in ios'. Default is the same name as the ios.
-
iosScrollToTop (for iOS, optional) : On iOS, you can tap on the status bar to scroll to the top of the webview. Setting this to false disable the feature. Default is true.
-
backgroundColor (optional) : The background color of the native webview. This background is visible (quickly) when the webview is loading, and when the user does a pulToRefresh on iOS. Default depends on your app native styles. See supported colors at Cobalt Colors page.
-
pullToRefresh (optional): If set to true, a pullToRefresh is added to the webview. Default is false. Read more about pull to refresh here
-
infiniteScroll (optional) : If set to true, a pullToRefresh is added to the webview. Default is false. Read more about infinite scroll here
The default key allows you to specify the controller and options to use if a navigation call is made without specifying a controller name, or when the specified controller is not found.
This file have to be in the root directory of your "www" folder.
Cobalt is an Open-Source Hybrid Mobile Framework. Read more about it on the home page or in the documentation
- Introduction to Cobalt navigation
- The cobalt.json file
- native navigation bars
- Handling the Android back button
- Introduction to Cobalt messages
- Publish/Subscribe on the Web side
- Publish/Subscribe on Android
- Publish/Subscribe on iOS
- Web Lifecycle messages
- Pull-To-Refresh and Infinite Scroll
- Custom alerts and Toasts
- LocalStorage
- OpenExternalUrl
- PlatformInfos
- Ajax
- Removing the top bar
- Adding Cobalt to an existing project
- Customizing your hybrid views
- Handle multiple Cobalt webviews on the same screen (TODO)