Changeset View
Changeset View
Standalone View
Standalone View
src/it/reyboz/bustorino/fragments/CommonScrollListener.java
Show First 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { | ||||
FragmentListenerMain listener = listenerWeakReference.get(); | FragmentListenerMain listener = listenerWeakReference.get(); | ||||
if(listener==null){ | if(listener==null){ | ||||
//can't do anything, sorry | //can't do anything, sorry | ||||
Log.i(this.getClass().getName(),"called onScroll but FragmentListener is null"); | Log.i(this.getClass().getName(),"called onScroll but FragmentListener is null"); | ||||
return; | return; | ||||
} | } | ||||
if (firstVisibleItem>=0) { | if (firstVisibleItem>=0) { | ||||
if (lastvisibleitem < firstVisibleItem) { | if (lastvisibleitem < firstVisibleItem) { | ||||
Log.i("Busto", "Scrolling DOWN"); | //Log.i("Busto", "Scrolling DOWN"); | ||||
listener.showFloatingActionButton(false); | listener.showFloatingActionButton(false); | ||||
//lastScrollUp = true; | //lastScrollUp = true; | ||||
} else if (lastvisibleitem > firstVisibleItem) { | } else if (lastvisibleitem > firstVisibleItem) { | ||||
Log.i("Busto", "Scrolling UP"); | //Log.i("Busto", "Scrolling UP"); | ||||
listener.showFloatingActionButton(true); | listener.showFloatingActionButton(true); | ||||
//lastScrollUp = false; | //lastScrollUp = false; | ||||
} | } | ||||
lastvisibleitem = firstVisibleItem; | lastvisibleitem = firstVisibleItem; | ||||
} | } | ||||
if(enableRefreshLayout){ | if(enableRefreshLayout){ | ||||
boolean enable = false; | boolean enable = false; | ||||
if(view != null && view.getChildCount() > 0){ | if(view != null && view.getChildCount() > 0){ | ||||
Show All 19 Lines |
Public contents are in Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) or GNU Free Documentation License (at your option) unless otherwise noted. · Contact / Register