BlowTorch - DRAFT version 1
|
Called when all plugins have been parsed and loaded, but before the connection to the server is initiated.
none |
When the BlowTorch core has initiated a settings serialization (saves the settings) this will be called to notify the plugin that it needs to serialize any data that it needs to, and provides an android.xml.XMLSerializer that is set up to be either to the main settings wad or the external plugin's descriptor file.
out | android.xml.XmlSerialzer represent the output serializer object. |
This function is called whenever a plugin defined option has changed through the user activating the options menu UI.
key | string the key value of the option that changed |
value | string the new value of the option |
This function is called during the loading process when scripts attach xml element listeners. These are used in order to parse custom data that is saved in the descriptor file.
none |
Called during window creation. After the main script has been loaded and the actual backing android View is created and shown.
none |
This function is called whenever the window is dirty and needs to redraw custom content.
canvas |
When the foreground process is being terimnated normally; used for memory management (freeing custom bitmaps, data, stuff that needs to be garbage collected).
none |
Whenever the layout hierarchy initiates re-measuring (window hierarchy changed) this function is called, many times. There is much to know about this function. More documentation will come, but the information passed in the variables is called a measure spec. It contains the target dimension and the measurement mode. More information can be found here. <insert link>="">
widthspec | |
heightspec |
function OnMeasure(wspec,hspec) if(wspec == measurespec_width and hspec == measurespec_height) then return measured_width,measured_height end --Note(string.format("measurespecs: %d, %d\n",wspec,hspec)) measurespec_width = wspec measurespec_height = hspec measured_width = MeasureSpec:getSize(wspec) --local wmode = MeasureSpec:getMode(wspec) measured_height = MeasureSpec:getSize(hspec) --local hmode = MeasureSpec:getMode(hspec) function test() local orientation = view:getParent():getOrientation() end local ret,err = pcall(test,debug.traceback) if(not ret) then --there was a problem, but do we care --Note("stat widget is relative, width:"..measured_width.." height:"..measured_height.."\n") return measured_width,measured_height end local orientation = view:getParent():getOrientation() if(orientation == LinearLayout.VERTICAL) then view:fitFontSize(36) view:doFitFontSize(measured_width) measured_height = view:getLineSize()*view:getBuffer():getBrokenLineCount() --Note("stat widget is vertical, width:"..measured_width.." height:"..measured_height.."\n") return measured_width,measured_height else view:setCharacterSizes((measured_height-6)/3,2) measured_width = 37*view:measure("a") view:fitFontSize(-1) measured_height = view:getLineSize()*view:getBuffer():getBrokenLineCount() --Note("stat widget is horizontal, width:"..measured_width.." height:"..measured_height.."\n") return measured_width,measured_height end --end end
If the window's size changes this function is called.
new | width |
new | height |
old | width |
old | height |
function OnSizeChanged(w,h,oldw,oldh) Note("Window starting OnSizeChanged()") if(w == 0 and h == 0) then draw = false end end
Called during the activity creation process. [I think] Before OnCreate is called, but after the plugin windows have been loaded and the script bodies run.
menu | android.menu.Menu that is the menu for the foreground window activity. |
menucallback = {} function menucallback.onMenuItemClick(item) Note("menu item clicked") --this function must return true if it consumes the click event. return true end menucallback_cb = luajava.createProxy("android.view.MenuItem$OnMenuItemClickListener",menucallback) function PopulateMenu(menu) --see android Menu documentation, menu:add() returns an android.menu.MenuItem --that can be manipulated to have a drawable (more sample code coming soon) --and can be configured for Android 4.0 (ICS)+ features. item = menu:add(0,401,401,"Ex Button Sets") item:setOnMenuItemClickListener(buttonsetMenuClicked_cb) end