Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-9405] Android: slider 'touchEnd' event it's not always fired

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionDuplicate
Resolution Date2012-08-13T17:00:16.000+0000
Affected Version/sRelease 2.1.0, Release 1.8.2, Release 2.0.1, Release 2.1.1
Fix Version/sn/a
ComponentsAndroid
Labelsapi, parity, qe-3.1.1
ReporterFederico Casali
AssigneeNeeraj Gupta
Created2012-06-05T15:38:26.000+0000
Updated2013-05-21T22:42:42.000+0000

Description

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

Comments

  1. Olga Romero 2013-05-21

    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:
       05-21 15:40:16.107: I/TiAPI(14022):  Touch started: undefined
       05-21 15:40:17.087: I/TiAPI(14022):  Touch ended: undefined
       05-21 15:40:18.947: I/TiAPI(14022):  Touch started: undefined
       05-21 15:40:19.317: I/TiAPI(14022):  Touch ended: undefined
       05-21 15:40:21.077: I/TiAPI(14022):  Touch started: undefined
       05-21 15:40:21.227: I/TiAPI(14022):  Touch ended: undefined
       

JSON Source