public void OnScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { if (OnScrollListener != null) OnScrollListener.OnScroll(view, firstVisibleItem, visibleItemCount, totalItemCount); if (totalItemCount == 0) return; if (IsSameRow(firstVisibleItem)) { var newScrollY = TopItemScrollY; var isSignificantDelta = Math.Abs(lastScrollY - newScrollY) > ScrollThreshold; if (isSignificantDelta) { if (lastScrollY > newScrollY) OnScrollUp(); else OnScrollDown(); } lastScrollY = newScrollY; } else { if (firstVisibleItem > previousVisibleItem) OnScrollUp(); else OnScrollDown(); lastScrollY = TopItemScrollY; previousVisibleItem = firstVisibleItem; } }
void AbsListView.IOnScrollListener.OnScrollStateChanged(AbsListView view, ScrollState scrollState) { ////switch (scrollState) ////{ //// case ScrollState.Idle:// 是当屏幕停止滚动时 //// scrollFlag = false; //// var lastPostion = view.LastVisiblePosition; //// var viewCount = view.Count; //// if (lastPostion==viewCount-1) //// { //// } //// break; //// case ScrollState.TouchScroll:// 滚动时 //// scrollFlag = true; //// break; //// case ScrollState.Fling:// 是当用户由于之前划动屏幕并抬起手指,屏幕产生惯性滑动时 //// scrollFlag = false; //// break; ////} ////listview滚动时会执行这个方法,这儿调用加载数据的方法。 //_adapter.NotifyDataSetChanged();//提醒adapter更新 //_listView.SetSelection(_lastItem - 1); ;//设置listview的当前位置,如果不设置每次加载完后都会返回到list的第一项。 }
public void OnScroll (AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { Console.WriteLine ("on scrolll event"); if (psl.mDelegateOnScrollListener != null) { // delegate psl.mDelegateOnScrollListener.OnScroll(view, firstVisibleItem, visibleItemCount, totalItemCount); } // get expected adapter or fail fast IListAdapter adapter = psl.Adapter; if (adapter == null || visibleItemCount == 0) return; // nothing to do Boolean isFirstVisibleItemSection = isItemViewTypePinned(adapter, adapter.GetItemViewType(firstVisibleItem)); if (isFirstVisibleItemSection) { View sectionView = psl.GetChildAt(0); if (sectionView.Top == psl.PaddingTop) { // view sticks to the top, no need for pinned shadow psl.destroyPinnedShadow(); } else { // section doesn't stick to the top, make sure we have a pinned shadow psl.ensureShadowForPosition(firstVisibleItem, firstVisibleItem, visibleItemCount); } } else { // section is not at the first visible position int sectionPosition = psl.findCurrentSectionPosition(firstVisibleItem); if (sectionPosition > -1) { // we have section position psl.ensureShadowForPosition(sectionPosition, firstVisibleItem, visibleItemCount); } else { // there is no section for the first visible item, destroy shadow psl.destroyPinnedShadow(); } } }
void AbsListView.IOnScrollListener.OnScrollStateChanged(AbsListView view, ScrollState scrollState) { if (OnScrollStateChanged != null) { OnScrollStateChanged(view, scrollState); } }
void list_Scroll(object sender, AbsListView.ScrollEventArgs e) { for (int i = e.FirstVisibleItem - adapter.HeadersCount; i < e.FirstVisibleItem + e.VisibleItemCount - adapter.FootersCount; i++) { (ViewModel as SearchQuestionsResultsViewModel).Questions[i].OnShowing(); } }
void OnScrollStateChanged (object sender, AbsListView.ScrollStateChangedEventArgs e) { var view = (AbsListView)sender; switch (e.ScrollState) { case ScrollState.Idle: mBusy = false; int first = view.FirstVisiblePosition; int count = view.ChildCount; for (int i = 0; i < count; i++) { TextView t = (TextView)view.GetChildAt (i); if (t.Tag != null) { t.Text = (Cheeses.CheeseStrings[first + i]); t.Tag = null; } } mStatus.Text = "Idle"; break; case ScrollState.TouchScroll: mBusy = true; mStatus.Text = "Touch scroll"; break; case ScrollState.Fling: mBusy = true; mStatus.Text = "Fling"; break; } }
void HandleListRecycling (object sender, AbsListView.RecyclerEventArgs e) { var favView = e.View as FavoriteView; if (favView == null) return; favView.ClearMap (); }
void AbsListView.IOnScrollListener.OnScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { if (OnScroll != null) { OnScroll(view, firstVisibleItem, visibleItemCount, totalItemCount); } }
void HandleScroll (object sender, AbsListView.ScrollEventArgs e) { if (loading || e.FirstVisibleItem + e.VisibleItemCount + 1 < e.TotalItemCount || !hasNextPage) return; loading = true; DoFetch (); }
void list_Scroll(object sender, AbsListView.ScrollEventArgs e) { var tournaments = (ViewModel as LastAddedTournamentsViewModel).Tournaments; for (int i = e.FirstVisibleItem - listView.HeaderViewsCount; i < e.FirstVisibleItem + e.VisibleItemCount - listView.FooterViewsCount && i < tournaments.Count; i++) { tournaments[i].OnShowing(); } }
/** * Returns the position within the adapter's dataset for the view, where view is an adapter item or a descendant of an adapter item. * Unlike {@link AdapterView#getPositionForView(android.view.View)}, returned position will reflect the position of the item given view is representing, * by subtracting the header views count. * * @param absListView the ListView containing the view. * @param view an adapter item or a descendant of an adapter item. This must be visible in given AdapterView at the time of the call. * * @return the position of the item in the AdapterView represented by given view, or {@link AdapterView#INVALID_POSITION} if the view does not * correspond to a list item (or it is not visible). */ public static int getPositionForView(AbsListView absListView, View view) { int position = absListView.GetPositionForView(view); if (absListView is ListView) { position -= ((ListView)absListView).HeaderViewsCount; } return position; }
void list_Scroll(object sender, AbsListView.ScrollEventArgs e) { if (e.FirstVisibleItem + e.VisibleItemCount == e.TotalItemCount) { if (ViewModel.IsMoreAvailable && !ViewModel.IsBusy) { ViewModel.LoadMoreCommand.Execute(null); } } }
void Android.Widget.AbsListView.IOnScrollListener.OnScrollStateChanged(Android.Widget.AbsListView view, Android.Widget.ScrollState scrollState) { if (scrollState == Android.Widget.ScrollState.Idle) { if (mPostsListView.LastVisiblePosition >= mPostsListView.Count - 1) { CatalogNewsViewModel.MoreNewsCommand.Execute(null); } } }
public void OnScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { bool loadMore = firstVisibleItem + visibleItemCount >= totalItemCount && totalItemCount > 0; if (loadMore && adapter.Adding == false) { adapter.AppendMoreData(); //adapter.NotifyDataSetChanged(); } }
public void OnScrollStateChanged(AbsListView view, ScrollState scrollState) { if (hideToolbar && ActionBar.IsShowing) { ActionBar.Hide(); } else if (!hideToolbar && !ActionBar.IsShowing) { ActionBar.Show(); } }
void nativeListView_Scroll(object sender, AbsListView.ScrollEventArgs e) { int visblepos = nativeListView.FirstVisiblePosition; if( formsListView != null && formsListView.Scroll != null ) { formsListView.Scroll(visblepos - 1); } System.Diagnostics.Debug.WriteLine( "Current visible : " + visblepos.ToString() ); }
public void OnScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { lock (this.Lock) { var loadMore = firstVisibleItem + visibleItemCount >= (totalItemCount - 3); if (loadMore && this.ViewModel.CanLoadMore && !this.ViewModel.IsBusy) { this.ViewModel.LoadMoreCommand.Execute(null); } } }
public void OnScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { if (firstVisibleItem > Math.Max(previousFirstVisvibleItem, 3)) { //User scrolls down by at least one item previousFirstVisvibleItem = firstVisibleItem; hideToolbar = true; } else if (firstVisibleItem +1 < previousFirstVisvibleItem) { //User scrolls up by at least one item hideToolbar = false; } }
public static void SetListViewHeightBasedOnChildren(AbsListView listView, float marginBetweenItems) { var listAdapter = listView.Adapter; if (listView == null || listAdapter == null || listAdapter.Count == 0) return; int desiredWidth = View.MeasureSpec.MakeMeasureSpec(listView.Width, MeasureSpecMode.Unspecified); int totalHeight = 0; View view = null; for (int i = 0; i < listAdapter.Count; i++) { view = listAdapter.GetView(i, view, listView); if (i == 0) view.LayoutParameters = new ViewGroup.LayoutParams(desiredWidth, WindowManagerLayoutParams.WrapContent); //view.Measure(desiredWidth, MeasureSpecMode.Unspecified); view.Measure(desiredWidth, 0); totalHeight += view.MeasuredHeight; } // Add margin totalHeight += Convert.ToInt32((float)(listAdapter.Count - 1) * marginBetweenItems); if (listView is ListView) { // Add divider totalHeight += (((ListView)listView).DividerHeight * (listAdapter.Count - 1)); } if (listView is GridView) { // Consider multiple columns var columns = ((GridView)listView).NumColumns; var denominator = listAdapter.Count / columns; var singleItemHeight = totalHeight / listAdapter.Count; totalHeight = totalHeight / columns; if (listAdapter.Count % denominator != 0) totalHeight += singleItemHeight / 2; } ViewGroup.LayoutParams p = listView.LayoutParameters; p.Height = totalHeight; listView.LayoutParameters = p; }
async public void OnScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { if (Master.SwipeRefreshLayout != null) { int topRowVerticalPosition = (Master.ListView == null || Master.ListView.ChildCount == 0) ? 0 : Master.ListView.GetChildAt(0).Top; Master.SwipeRefreshLayout.Enabled = (firstVisibleItem == 0 && topRowVerticalPosition >= 0); } if (firstVisibleItem + visibleItemCount == Master.GetTableItemCount() && Master.GetTableItemCount() != 0) { if (!Master.Fetching) { Master.Fetching = true; Master.ToggleProgressBarInFooter(true); Master.Offset = Master.GetTableItemCount(); await Master.FetchTableData(); } } }
public void OnScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { System.Diagnostics.Debug.WriteLine(firstVisibleItem); if (firstVisibleItem + visibleItemCount == totalItemCount) { // Clear items, add from current half way to chunk size after last item, scroll back to old last item var firstItem = adapter.GetItem(chunksize); adapter.Clear (); for (int i = 0; i < chunksize*2; i++) { adapter.Add(firstItem.AddDays (i)); } adapter.NotifyDataSetChanged (); view.SetSelection (chunksize-visibleItemCount-1); } else if (firstVisibleItem == 0) { // Clear items, add from chunk size before first item, scroll back to old first item var lastItem = adapter.GetItem(chunksize); adapter.Clear (); for (int i = chunksize*2-1; i >= 0; i--) { adapter.Add(lastItem.AddDays (-i)); } adapter.NotifyDataSetChanged (); view.SetSelection (chunksize-1); } }
void Android.Widget.AbsListView.IOnScrollListener.OnScroll(Android.Widget.AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { //throw new System.NotImplementedException (); }
public void OnScroll (AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { if (isBtnAllSelected) { iCurrentPosAll = firstVisibleItem; } else { iCurrentPosCompleted = firstVisibleItem; } }
public void OnScrollStateChanged (AbsListView view, ScrollState scrollState) { Enabled = scrollState != ScrollState.TouchScroll; }
public void OnScroll (AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { }
void AbsListView.IOnScrollListener.OnScrollStateChanged (AbsListView view, ScrollState scrollState) { if (scrollState == ScrollState.Idle) { UpdateChildrenControlPoints(0); } }
void AbsListView.IOnScrollListener.OnScroll (AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { }
static void n_SetAdapter_Landroid_widget_ListAdapter_(IntPtr jnienv, IntPtr native__this, IntPtr native_adapter) { AbsListView __this = Java.Lang.Object.GetObject <Android.Widget.AbsListView> (jnienv, native__this, JniHandleOwnership.DoNotTransfer); __this.Adapter = Java.Interop.JavaConvert.FromJniHandle <IListAdapter> (native_adapter, JniHandleOwnership.DoNotTransfer); }
public void OnScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { if (OverScrollCanceled != null) OverScrollCanceled (); }
public void OnScrollStateChanged(AbsListView view, int scrollState) { ScrollStateChanged.Invoke(view, new ScrollStateChangedEventArgs((ScrollState)scrollState)); }
public void OnScrollStateChanged(AbsListView view, ScrollState scrollState) { mCurrentScrollState = scrollState; if (mCurrentScrollState == ScrollState.Idle) { mBounceHack = false; } if (mOnScrollListener != null) { mOnScrollListener.OnScrollStateChanged(view, scrollState); } }
public void OnScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { Scroll.Invoke(view, new ScrollEventArgs(firstVisibleItem, visibleItemCount, totalItemCount)); }
private bool CanScrollUp(Android.Views.View view) { if (!RefreshView.IsPullToRefreshEnabled) { return(true); } else { ViewGroup viewGroup = view as ViewGroup; if (viewGroup == null) { return(base.CanChildScrollUp()); } int sdk = (int)global::Android.OS.Build.VERSION.SdkInt; if (sdk >= 16) { // //is a scroll container such as listview, scroll view, gridview // if (viewGroup.IsScrollContainer) { return(base.CanChildScrollUp()); } } // //if you have something custom and you can't scroll up you might need to enable this //for instance on a custom recycler view where the code above isn't working! // for (int i = 0; i < viewGroup.ChildCount; i++) { var child = viewGroup.GetChildAt(i); if (child is Android.Widget.AbsListView) { Android.Widget.AbsListView list = child as Android.Widget.AbsListView; if (list != null) { if (list.FirstVisiblePosition == 0) { Android.Views.View subChild = list.GetChildAt(0); return(subChild != null && subChild.Top != 0); } // //if children are in list and we are scrolled a bit... sure you can scroll up // return(true); } } else if (child is Android.Widget.ScrollView) { Android.Widget.ScrollView scrollview = child as Android.Widget.ScrollView; return(scrollview.ScrollY <= 0.0); } else if (child is Android.Webkit.WebView) { Android.Webkit.WebView webView = child as Android.Webkit.WebView; return(webView.ScrollY > 0.0); } else if (child is Android.Support.V4.Widget.SwipeRefreshLayout) { return(CanScrollUp(child as ViewGroup)); } // //else if something else like a recycler view? // } return(false); } }
public void OnScrollStateChanged(AbsListView view, ScrollState scrollState) { }
public void setAbsListView(AbsListView absListView) { setListViewWrapper(new AbsListViewWrapper(absListView)); }
public void OnScrollStateChanged(AbsListView view, ScrollState scrollState) { if (OverScrollCanceled != null && (scrollState == ScrollState.Idle || scrollState == ScrollState.Fling)) OverScrollCanceled (); }