This plugin provides a native header and slider menu, and allows you to controll them from Javascript (appearance and behavior).
- Android 4.1 or higher.
New project:
cordova platform add https://github.com/BreixoAM/cordova-android-compat
cordova plugin add https://github.com/BreixoAM/cordova-plugin-nativebundle
Existing project:
cordova platform update https://github.com/BreixoAM/cordova-android-compat
cordova plugin add https://github.com/BreixoAM/cordova-plugin-nativebundle
var options = {
'mainColor': '#F44336',
'mainColorDark': '#C62828',
'title': 'Native Bundle Example'
};
var callback = function(frame) {
frame.header.setTitle('New title');
};
tgw.init(callback, options);
App on google play
Source code on github
#API
- .header
- .slider
- .content
- .getMainColor()
- .setMainColor()
- .getMainColorDark()
- .setMainColorDark()
- .showSpinner()
- .hideSpinner()
- .getTitle()
- .setTitle()
- .setItemsColor()
- .showBackButton()
- .showSliderButton()
- .clearOptions()
- .setOptions()
- .clearActions()
- .setActions()
Initializes the plugin on the native side.
callBack: will be called with frame object to manipulate the native elements.
options: init object.
- options.mainColor: header color.
- options.mainColorDark: status bar color.
- options.title: header title.
Header object.
Slider object.
Content object
Return header color.
Update header color.
mainColor: String. Example: '#F44336'
Return statusbar color.
Update statusbar color.
mainColorDark: String. Example: '#C62828'
Show native dialog spinner.
Hide native dialog spinner.
Return header title.
Update header title.
title: String. Example: 'New title'
Update color of title and buttons.
color: String. Example: '#FFFFFF'
Display back button and hide slider button.
Display slidder button and hide back button.
Display options on menu header.
options: array of objects.
- options.title: Option title.
- options.callback: function executed when the option is pressed.
Example:
[
{
'title': 'Deatils option',
'callback': function() {
setTimeout(function(){ alert('Details option'); }, 250);
}
}
]
Empty options.
Display actions on header.
actions: array of objects.
- actions.title: Option title.
- actions.icon: Icon from icons list.
- actions.callback: function executed when the action is pressed.
Example:
[
{
'title': 'Search',
'icon': 'search',
'callback': function() {
setTimeout(function(){ alert('Search'); }, 250);
}
}
]
Empty actions.
Update slider menu header color.
color: String. Example: '#F44336'
Return header menu title1.
Update header menu title1.
title: String. Example: 'New title 1'
Return header menu title2.
Update header menu title2.
title: String. Example: 'New title 2'
Update circle icon on menu header.
char: String. Example: 'A'
color1: String. String clor. Example: '#F44336'
color2: String. Circle color. Example: '#F44336'
Display options on slider.
options: array of objects.
- option.title: Option title.
- option.icon: Option icon.
- option.check: Init item as checked.
- option.callback: function executed when the option is pressed.
Example:
[
{
'icon': 'dashboard',
'title': 'Dashboard',
'checked': 0,
'callback': function(data) {
alert('Dashboard');
}
},
{
'icon': 'build',
'title': 'Build',
'checked': 0,
'callback': function(data) {
alert('Build');
}
}
]