diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/widget/listview/TiListView.java b/android/modules/ui/src/java/ti/modules/titanium/ui/widget/listview/TiListView.java index 56912042ce0..29b33a18b32 100644 --- a/android/modules/ui/src/java/ti/modules/titanium/ui/widget/listview/TiListView.java +++ b/android/modules/ui/src/java/ti/modules/titanium/ui/widget/listview/TiListView.java @@ -14,7 +14,6 @@ import java.util.List; import java.util.concurrent.atomic.AtomicInteger; -import android.util.TypedValue; import org.appcelerator.kroll.KrollDict; import org.appcelerator.kroll.KrollProxy; import org.appcelerator.kroll.common.Log; @@ -30,22 +29,16 @@ import org.appcelerator.titanium.view.TiCompositeLayout.LayoutParams; import org.appcelerator.titanium.view.TiUIView; -import ti.modules.titanium.ui.RefreshControlProxy; -import ti.modules.titanium.ui.SearchBarProxy; -import ti.modules.titanium.ui.UIModule; -import ti.modules.titanium.ui.android.SearchViewProxy; -import ti.modules.titanium.ui.widget.searchbar.TiUISearchBar; -import ti.modules.titanium.ui.widget.searchbar.TiUISearchBar.OnSearchChangeListener; -import ti.modules.titanium.ui.widget.searchview.TiUISearchView; -import ti.modules.titanium.ui.widget.TiSwipeRefreshLayout; import android.app.Activity; import android.content.Context; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.os.Build; import android.util.Pair; +import android.util.TypedValue; import android.view.LayoutInflater; import android.view.View; +import android.view.ViewConfiguration; import android.view.ViewGroup; import android.view.ViewParent; import android.widget.AbsListView; @@ -55,6 +48,15 @@ import android.widget.LinearLayout; import android.widget.TextView; +import ti.modules.titanium.ui.RefreshControlProxy; +import ti.modules.titanium.ui.SearchBarProxy; +import ti.modules.titanium.ui.UIModule; +import ti.modules.titanium.ui.android.SearchViewProxy; +import ti.modules.titanium.ui.widget.TiSwipeRefreshLayout; +import ti.modules.titanium.ui.widget.searchbar.TiUISearchBar; +import ti.modules.titanium.ui.widget.searchbar.TiUISearchBar.OnSearchChangeListener; +import ti.modules.titanium.ui.widget.searchview.TiUISearchView; + public class TiListView extends TiUIView implements OnSearchChangeListener { @@ -403,7 +405,14 @@ public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCoun _firstVisibleItem = firstVisibleItem; _visibleItemCount = visibleItemCount; int scrolledOffset = listView.getVerticalScrollOffset(); - if (scrolledOffset != mInitialScroll) { + + ViewConfiguration viewConfiguration = ViewConfiguration.get(activity); + int scrollDamping = 0; + if (viewConfiguration != null) { + scrollDamping = viewConfiguration.getScaledTouchSlop(); + } + + if (Math.abs(mInitialScroll - scrolledOffset) > scrollDamping) { if (scrolledOffset > mInitialScroll) { scrollUp = 1; } else { diff --git a/apidoc/Titanium/UI/ListView.yml b/apidoc/Titanium/UI/ListView.yml index 564c7d9ff9a..67c4deb8528 100644 --- a/apidoc/Titanium/UI/ListView.yml +++ b/apidoc/Titanium/UI/ListView.yml @@ -261,7 +261,7 @@ events: - name: itemsselected summary: | - Fired when user stops two-pan gesture interaction for selecting multiple items. + Fired when user stops two-pan gesture interaction for selecting multiple items. It is used with . properties: - name: selectedItems @@ -744,9 +744,9 @@ properties: - name: allowsMultipleSelectionInteraction summary: Allows a two-finger pan gesture to automatically transition the table view into editing mode and start selecting rows. description: | - Setting this property to true allows the user to start selecting multiple contiguous rows via a two-finger pan gesture. - If the table view is already in editing mode, the user can also select multiple rows via a one-finger pan gesture along - the edge of the table that contains editing controls (checkboxes). In order to support this behavior, + Setting this property to true allows the user to start selecting multiple contiguous rows via a two-finger pan gesture. + If the table view is already in editing mode, the user can also select multiple rows via a one-finger pan gesture along + the edge of the table that contains editing controls (checkboxes). In order to support this behavior, you must also set to true. Once user interaction stops the event is fired. type: Boolean @@ -1118,8 +1118,8 @@ properties: - name: showSearchBarInNavBar summary: A Boolean indicating whether search bar will be in navigation bar. description: | - If you want to show the search bar in navigation bar, set this property `true` during creation. - Use the property to control the visibility of the + If you want to show the search bar in navigation bar, set this property `true` during creation. + Use the property to control the visibility of the searchbar when scrolling. type: Boolean default: false