Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-8426

Android: add a click event listener for plain Pickers

    Details

    • Sprint:
      Release 3.0.0

      Description

      Request description

      Customer requirement is to have an additional event on 'Ti.UI.PICKER_TYPE_PLAIN' Pickers.

      The new event should indicate that the user clicked on the picker (when it's in its combo-box-looking state). This would fire before the list-of-choices appears, triggering a function following a 'click' event.

      Additional notes

      Customer ticket: http://support-admin.appcelerator.com/display/APP-433276
      iOS parity ticket: http://jira.appcelerator.org/browse/TIMOB-8427

      Testing steps:
      1. Run this code:

      var win = Ti.UI.createWindow();
      	win.backgroundColor = 'black';
      	
      	var picker = Ti.UI.createPicker();
      	
      	var data = [];
      	data[0]=Ti.UI.createPickerRow({title:'Bananas',custom_item:'b'});
      	data[1]=Ti.UI.createPickerRow({title:'Strawberries',custom_item:'s'});
      	data[2]=Ti.UI.createPickerRow({title:'Mangos',custom_item:'m'});
      	data[3]=Ti.UI.createPickerRow({title:'Grapes',custom_item:'g'});
      	
      	// turn on the selection indicator (off by default)
      	picker.selectionIndicator = true;
      	
      	picker.add(data);
      	
      	win.add(picker);
      	
      	picker.setSelectedRow(0,1,true);
      	
      	var label = Ti.UI.createLabel({
      		text:'Make a move',
      		top:6,
      		width:'auto',
      		height:'auto',
      		textAlign:'center',
      		color:'white'
      	});
      	win.add(label);
      	
      	picker.addEventListener('change',function(e)
      	{
      		Ti.API.info("You selected row: "+e.row+", column: "+e.column+", custom_item: "+e.row.custom_item);
      		label.text = "row index: "+e.rowIndex+", column index: "+e.columnIndex;
      	});
      	
      	picker.addEventListener('click',function(e)
      	{
      		Ti.API.info("You click on " + e.source);
      	});
      	
      	picker.setSelectedRow(0,1,false);
      	win.open();
      

      2. Click on Picker, you should see log indicating click event was fired.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                hpham Hieu Pham
                Reporter:
                fcasali Federico Casali
              • Watchers:
                10 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                    Git Integration