public static void MakeFlingAware(this AbsListView list) { list.SetOnScrollListener(new ScrollChangedListener((view, state) => { (view.Adapter as IFlingAwareAdapter).FlingScrollActive = state == ScrollState.Fling; })); }
public static void MakeFlingAware(this AbsListView list, Action <bool> action) { list.SetOnScrollListener(new ScrollChangedListener((view, state) => { action.Invoke(state == ScrollState.Fling); })); }
public static void MakeFlingAware(this AbsListView list, Action <bool> action) { list.SetOnScrollListener(new OnScrollListener(null, tuple => { action.Invoke(tuple.Item2 == ScrollState.Fling); })); }
/// <summary> /// Bind this class to the goto top button in the parent view /// </summary> /// <param name="parentView"></param> /// <param name="listView"></param> public void BindControl(View parentView, AbsListView listView) { if (parentView != null) { fab = parentView.FindViewById <FloatingActionButton>(Resource.Id.goto_top_button); if (fab != null) { // Hide the button initially fab.Visibility = ViewStates.Gone; // Hook into the listview's scroll events listView.SetOnScrollListener(this); // Scroll back to the top when the button is clicked fab.Click += (sender, e) => { if (listView.FirstVisiblePosition > 20) { listView.SetSelection(20); } listView.SmoothScrollToPosition(0); }; } } else { fab = null; } }
public static void ClearFlingAdapter(this AbsListView container) { if (FlingStates.ContainsKey(container)) { FlingStates.Remove(container); } container.SetOnScrollListener(null); }
public void AttachToListView(AbsListView listView, IScrollDirectorListener scrollDirectionListener = null, AbsListView.IOnScrollListener onScrollListener = null) { var scrollDetector = new AbsListViewScrollDetectorImpl(this); scrollDetector.ScrollDirectionListener = scrollDirectionListener; scrollDetector.OnScrollListener = onScrollListener; scrollDetector.ListView = listView; scrollDetector.ScrollThreshold = scrollThreshold; listView.SetOnScrollListener(scrollDetector); }
public void ConfigureBrowsingFor ( AbsListView abstractBrowseView, Func <int> getThumbnailWidth, Action viewTypeChanged, Action scaleTypeChanged ) { _abstractBrowseView = abstractBrowseView; _getThumbnailWidth = getThumbnailWidth; _viewTypeChanged = viewTypeChanged; _scaleTypeChanged = scaleTypeChanged; _abstractBrowseView.ScrollBarStyle = ScrollbarStyles.InsideInset; _abstractBrowseView.FastScrollEnabled = true; _abstractBrowseView.FastScrollAlwaysVisible = true; AbsListView.IOnScrollListener browseScrollListener = CreateScrollListener(); _abstractBrowseView.SetOnScrollListener(browseScrollListener); _gridViewButton = Activity.FindViewById <Button>(Resource.Id.GridViewButton); _gridViewButton.Click -= GridViewButtonClicked; _gridViewButton.Click += GridViewButtonClicked; _gridViewButton.LongClick -= ModeButtonLongClicked; _gridViewButton.LongClick += ModeButtonLongClicked; _listViewButton = Activity.FindViewById <Button>(Resource.Id.ListViewButton); _listViewButton.Click -= ListViewButtonClicked; _listViewButton.Click += ListViewButtonClicked; _listViewButton.LongClick -= ModeButtonLongClicked; _listViewButton.LongClick += ModeButtonLongClicked; _cropThumbnailButton = Activity.FindViewById <Button>(Resource.Id.CropThumbnailButton); _cropThumbnailButton.Click -= CropThumbnailButtonClicked; _cropThumbnailButton.Click += CropThumbnailButtonClicked; _cropThumbnailButton.LongClick -= ModeButtonLongClicked; _cropThumbnailButton.LongClick += ModeButtonLongClicked; _fitThumbnailButton = Activity.FindViewById <Button>(Resource.Id.FitThumbnailButton); _fitThumbnailButton.Click -= FitThumbnailButtonClicked; _fitThumbnailButton.Click += FitThumbnailButtonClicked; _fitThumbnailButton.LongClick -= ModeButtonLongClicked; _fitThumbnailButton.LongClick += ModeButtonLongClicked; }
private void ApplyScrollListener() { listView.SetOnScrollListener(new PauseOnScrollListener(ImageLoader.Instance, pauseOnScroll, pauseOnFling)); }
public void ClearFlingAdapter() { _view.SetOnScrollListener(null); _view.Adapter = null; }