Problem description
On Android, slider "touchend" events are not triggered if the finger is released from the screen when it's no longer on the picker
Expected results
The alert being shown on touchend event.
Actual Results
In SDK 2.1.1 it's working fine in Android 2.2.2, but failing to provide the alert in Android OS 4.1
Sample code
Run the sample code below.
Start moving the slider and release the finger when the finger is still on top of the slider.
Result: alert it's being displayed
Move the slider again and release the finger when the finger it's no longer on top of the slider
Result: event it's not triggered and alert it's not displayed.
It's only reproducible on Android OS. On iOS platform works as expected.
var win = Titanium.UI.createWindow({
title:'test',
backgroundColor:'white'
});
//
// BASIC SLIDER
//
var basicSliderLabel = Titanium.UI.createLabel({
text:'Basic Slider',
color:'#999',
font:{
fontFamily:'Helvetica Neue',
fontSize:15
},
textAlign:'center',
top:10,
width:300,
height:'auto'
});
var basicSlider = Titanium.UI.createSlider({
min:0,
max:10,
value:5,
width:200,
height:Ti.UI.SIZE,
top:50,
// selectedThumbImage:'../images/slider_thumb.png',
// highlightedThumbImage:'../images/chat.png'
});
basicSlider.addEventListener('change',function(e)
{
basicSliderLabel.text = 'Basic Slider';
});
// For #806
basicSlider.addEventListener('touchstart', function(e)
{
Ti.API.info('#### Touch started: ');
});
basicSlider.addEventListener('touchend', function(e)
{
Ti.API.info('#### Touch ended: ');
alert('Touch ended')
});
basicSlider.value = 0;
win.add(basicSliderLabel);
win.add(basicSlider);
Ti.API.info('platform = ' + Titanium.Platform.osname);
win.open();
Simpler Test Case
var win=Titanium.UI.createWindow({backgroundColor:'#FFFFFF'});
var slider1 = Ti.UI.createSlider({
top : 25,
value : 30,//_params.value,
min : 0,//_params.min,
max : 65, //_params.max,
left:0,
width:'65%'
});
slider1.addEventListener('touchend',function(e){
alert(e.value)
});
win.add(slider1);
win.open();
Additional notes / Discussion
Ticket link:
http://support-admin.appcelerator.com/display/APP-933556/conversation/read_all
Extra comments
This is failing in some devices, like:
DeviceS: Motorola MB860 (OS ver 2.3.4) - FAILING.
Devices: Google Nexus Tablet 7 OS Ver 4.1 - FAILING
Appcelerator Studio, build: 3.1.1.201305181057 SDK, billd: 3.1.1.v20130520171545 Devices: Nexus 7 Android version: 4.2 GalaxyS3 Android version: 4.0.4 Actual result: