User Tools

Site Tools


script_action_bar_sample

**This is an old revision of the document!** ----

A PCRE internal error occured. This might be caused by a faulty plugin

====== About the script ====== * Purpose : A sample script to configure and display the action bar, then react to button presses * Author : Pierre Hébert Starting at V14a9, Lightning allows the standard android action bar to be displayed in the home screen or in the app drawer (in which case it replaces the custom one). This API is available for Android devices >= 19 (4.4, KitKat). API reference: http://www.lightninglauncher.com/scripting/reference/api-alpha/reference/net/pierrox/lightning_launcher/script/api/screen/ActivityScreen.html#showActionBar(Function, Function) ====== How to use the script ====== Copy/paste the code below in a new script, then execute the script from a shortcut on your desktop. ====== Script code ====== <sxh javascript> bindClass("android.view.MenuItem"); getEvent().getScreen().showActionBar(create, select); function create(menu) { var item = menu.add("Hello action bar!"); item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); item.setIcon(Image.createTextIcon("q", 96, 0xffffffff, 0, null).toDrawable(); return true; } function select(item) { alert(item.getTitle()); return true; } </sxh>

script_action_bar_sample.1475669525.txt.gz · Last modified: 2016/10/05 12:12 by pierrox