Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-27879] Android: ListView should only fire "scrolling" event when moving a min distance

GitHub Issuen/a
TypeNew Feature
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2020-08-07T10:39:23.000+0000
Affected Version/sn/a
Fix Version/sRelease 9.1.0
ComponentsAndroid
LabelsScrollView, android, scroll
ReporterMichael Gangolf
AssigneeJoshua Quick
Created2020-05-03T13:35:42.000+0000
Updated2020-08-07T10:39:23.000+0000

Description

Android's ListView can spam a "scrolling" event even when your finger is held at a single position. This is because there is currently no touch tolerance applied and 1 pixel scroll movement will fire the event. It should only fire a "scrolling" event when the scroll direction changes and for a minimum pixel distance specified by Google's [ViewConfiguration.getScaledTouchSlop()](https://developer.android.com/reference/android/view/ViewConfiguration#getScaledTouchSlop()) API.
var win = Ti.UI.createWindow({backgroundColor: 'gray'});
var listView = Ti.UI.createListView();
var sections = [];

var fruitSection = Ti.UI.createListSection({ headerTitle: 'Fruits'});
var fruitDataSet = [
    {properties: { height: 100,title: 'Apple'}},
    {properties: { height: 100,title: 'Apple'}},
    {properties: { height: 100,title: 'Apple'}},
    {properties: { height: 100,title: 'Apple'}},
    {properties: { height: 100,title: 'Apple'}},
    {properties: { height: 100,title: 'Apple'}},
    {properties: { height: 100,title: 'Apple'}},
    {properties: { height: 100,title: 'Banana'}},
    {properties: { height: 100,title: 'Banana'}},
    {properties: { height: 100,title: 'Banana'}},
    {properties: { height: 100,title: 'Banana'}},
    {properties: { height: 100,title: 'Banana'}},
    {properties: { height: 100,title: 'Banana'}},
    {properties: { height: 100,title: 'Banana'}},
    {properties: { height: 100,title: 'Banana'}},
    {properties: { height: 100,title: 'Banana'}},
    {properties: { height: 100,title: 'Banana'}},
    {properties: { height: 100,title: 'Banana'}},
    {properties: { height: 100,title: 'Banana'}},
];
fruitSection.setItems(fruitDataSet);
sections.push(fruitSection);

listView.appendSection(sections);
listView.addEventListener("scrolling",function(e){
	console.log(e.direction);
})
win.add(listView);
win.open();

Comments

  1. Michael Gangolf 2020-05-03

    PR: https://github.com/appcelerator/titanium_mobile/pull/11680
  2. Samir Mohammed 2020-07-02

    FR Passed, waiting on Jenkins build.
  3. Christopher Williams 2020-07-06

    merged to master for 9.1.0 target
  4. Sohail Saddique 2020-08-07

    Fix verified on build 9.1.0.v20200804082025. Ticket closed.

JSON Source