[TIMOB-27879] Android: ListView should only fire "scrolling" event when moving a min distance
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2020-08-07T10:39:23.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 9.1.0 |
Components | Android |
Labels | ScrollView, android, scroll |
Reporter | Michael Gangolf |
Assignee | Joshua Quick |
Created | 2020-05-03T13:35:42.000+0000 |
Updated | 2020-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();
PR: https://github.com/appcelerator/titanium_mobile/pull/11680
FR Passed, waiting on Jenkins build.
merged to master for 9.1.0 target
Fix verified on build 9.1.0.v20200804082025. Ticket closed.