Thursday, 29 August 2013

Android Native Controls Module for Titanium

NativeControls - This module helps to create android native controls in titanium.

My Colleague J.Kabeer given an idea to implement module for missing Android native controls.

Initially we start this module with RadioGroup and later version we will plan to update most of the controls.

Feature:
  • Create android native RadioGroup in titanium
  • You can set the default selectedIndex value to RadioGroup
  • You can add "chage" EventListener to RadioGroup
  • You can get selected RadioButton Object value  using getSelectedIndexValue() Method
  • Define text color by set textColor value
  • Define layoutType by set the layoutType = "horizontal/vertical"
  • Passing radio buttons as array of object in "buttons"  

Usage:
var nativecontrols = require('learnappcelerator.nativecontrols');

var radiogroup = nativecontrols.createRadioGroup({
 width : Ti.UI.SIZE,
 height : Ti.UI.SIZE,
 top : 100,
 left : 10,
 textColor : "",
 selectedIndex : 2,
 layoutType : "vertical",
 buttons : [{
  id : 1,
  text : 'value 11'
 }, {
  id : 2,
  text : 'value 12'
 }, {
  id : 3,
  text : 'value 13'
 }]
});

radiogroup.addEventListener('change', function(e) {
 alert(JSON.stringify(e.result));
 var obj=radiogroup.getSelectedButton();
 Ti.API.info("selected ButtonValue ="+JSON.stringify(obj));
});

win.add(radiogroup);


Screenshots




Version 1.1 -    RadioGroup   - available

Version 1.2 -  AutoCompleteTexBox  - will update soon.

Download:
Module:  https://marketplace.appcelerator.com/apps/6378?759209041