This plugin adds a hideable native toolbar to an app. The toolbar is displayed using a double tap gesture. The last button in the toolbar on Android displays items that do not fit or are less commonly used. On Android, the toolbar has been implemented as an action bar while on iOS it was implemented as a UIActivityViewController.
To learn more about icons have a look at Icons on Android, iOS Toolbar and Navigation Bar Buttons, iOS Content Views and Apache Cordova Icons and Splash Screens.
For additional details on the Toolbar plugin see the JavaScript file in a project that includes this plugin at
project_name\plugins\com.sap.mp.cordova.plugins.toolbar\www\toolbar.js
or the JS Documentation at Kapsel Toolbar API Reference.
The following steps will demonstrate how to modify the sample used in the logon plugin section to have the buttons such as read, lock, unlock, register and unregister be moved to the toolbar.
cordova -d plugin add com.sap.mp.cordova.plugins.toolbar
For Android you need to modify the activity theme in the AndroidManifest.xml to be android:theme="@android:style/Theme.Holo".
The minSdkVersion must also be changed to at least 11.
To make the change, modify the file C:\Kapsel_Projects\LogonDemo\platforms\android\AndroidManifest.xml and change<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/app_name" android:launchMode="singleTop" android:name="LogonDemo" android:theme="@android:style/Theme.Black.NoTitleBar">
to<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/app_name" android:launchMode="singleTop" android:name="LogonDemo" android:theme="@android:style/Theme.Holo">
and<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="19" />
to<uses-sdk android:minSdkVersion="11" android:targetSdkVersion="19" />
function addToolbarMenuItems(screenID) {
sap.Toolbar.clear();
if (screenID == "LoadingDiv") {
//Do not add any toolbar items.
}
else if (screenID == "LockedDiv") {
sap.Toolbar.addItem({"label" : "UnLock", "icon" : "ic_action_not_secure", "showAsAction" : sap.Toolbar.SHOW_AS_ACTION_ALWAYS }, function() {unlock();});
}
else if (screenID == "MainDiv") {
sap.Toolbar.addItem({"label" : "Read", "icon" : "ic_action_refresh", "showAsAction" : sap.Toolbar.SHOW_AS_ACTION_ALWAYS | sap.Toolbar.SHOW_AS_ACTION_WITH_TEXT }, function() {clearTable();read();});
if (applicationContext == null) {
sap.Toolbar.addItem({"label" : "Register", "icon" : "ic_action_add_person", "showAsAction" : sap.Toolbar.SHOW_AS_ACTION_ALWAYS }, function() {register();});
}
else {
sap.Toolbar.addItem({"label" : "UnRegister", "icon" : "no_icon", "showAsAction" : sap.Toolbar.SHOW_AS_ACTION_WITH_TEXT }, function() {unRegister();});
}
sap.Toolbar.addItem({"label" : "Lock", "icon" : "ic_action_secure", "showAsAction" : sap.Toolbar.SHOW_AS_ACTION_ALWAYS }, function() {lock();});
}
}
Add the below line to the showScreen method.addToolbarMenuItems(screenIDToShow);
Add the below line to the end of the method logonUnregisterSuccessCallback(result) method.showScreen("MainDiv");
Action Bar Icons\holo_dark\01_core_refresh
Action Bar Icons\holo_dark\06_social_add_person
Action Bar Icons\holo_dark\10_device_access_secure
Action Bar Icons\holo_dark\10_device_access_not_secure
Copy the child folders into C:\Kapsel_Projects\LogonDemo\platforms\android\res.~/SAP/MobileSDK3/KapselSDK/plugins/fioriclient/ios/SMPToolbar.xcassets/smp_reload.imageset
cordova -d prepare
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
43 | |
25 | |
17 | |
15 | |
10 | |
7 | |
7 | |
6 | |
6 | |
6 |