Ejemplo n.º 1
0
 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();
     }
 }
Ejemplo n.º 2
0
        void HandleScroll(object sender, AbsListView.ScrollEventArgs e)
        {
            lastVisibleItem = e.FirstVisibleItem + e.VisibleItemCount;

            if (!isLoading && adapter.ReflectionFeed.pagination != null && (adapter.ReflectionFeed.pagination.next_cursor > 0) && (lastVisibleItem == e.TotalItemCount))
            {
                isLoading = true;
                loadingView.Visibility = ViewStates.Visible;
                Task.Run(async delegate {
                    postsReq.Parameters.RemoveAll(x => x.Name == "cursor");
                    postsReq.AddParameter("cursor", adapter.ReflectionFeed.pagination.next_cursor);

                    var resp = client.Execute(postsReq);
                    var feed = JsonConvert.DeserializeObject <Feed> (resp.Content, serializerSettings);

                    adapter.ReflectionFeed.data.AddRange(feed.data);
                    adapter.ReflectionFeed.pagination = feed.pagination;
                    isLoading = false;
                    Activity.RunOnUiThread(() => {
                        UpdateView();
                        loadingView.Visibility = ViewStates.Gone;
                    });
                });
                // if we're at the bottom of the list, check that there's a next cursor number
            }
        }
Ejemplo n.º 3
0
        private void ScrollReporterEffect_Scroll(object sender, AbsListView.ScrollEventArgs e)
        {
            int pos = GetListViewYPosition();

            float dp = pos / Density;

            effect.OnScrollEffect(Element, new ScrollEventArgs(dp));
        }
Ejemplo n.º 4
0
        private void OnControlScroll(object sender, AbsListView.ScrollEventArgs e)
        {
            Android.Views.View view = Control.GetChildAt(0);

            if (view != null)
            {
                ((ListViewExtended)Element).YScrollOutput = (-view.Top + Control.FirstVisiblePosition * view.Height) / Context.Resources.DisplayMetrics.Density;
            }
        }
Ejemplo n.º 5
0
        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();
            }
        }
Ejemplo n.º 6
0
        void HandleScroll(object sender, AbsListView.ScrollEventArgs e)
        {
            if (loading || e.FirstVisibleItem + e.VisibleItemCount < e.TotalItemCount)
            {
                return;
            }
            loading = true;

            RetrieveActivityData(adapter);
        }
Ejemplo n.º 7
0
        private void FilmsListView_Scroll(object sender, AbsListView.ScrollEventArgs e)
        {
            bool scrollLimit = e.FirstVisibleItem + e.VisibleItemCount >= e.TotalItemCount - 10 && e.TotalItemCount != 0;

            if (scrollLimit && !_loadingMoreData && !WaitForItBLL.Singleton.NoMoreMoviesToLoad)
            {
                _loadingMoreData = true;
                new Thread(LoadAdditionnalMovies).Start();
            }
        }
Ejemplo n.º 8
0
 void list_Scroll(object sender, AbsListView.ScrollEventArgs e)
 {
     if (e.FirstVisibleItem + e.VisibleItemCount == e.TotalItemCount)
     {
         if (ViewModel.IsMoreAvailable && !ViewModel.IsBusy)
         {
             ViewModel.LoadMoreCommand.Execute(null);
         }
     }
 }
Ejemplo n.º 9
0
        private void Lw_Scroll(object sender, AbsListView.ScrollEventArgs e)
        {
            var ddd = e.View.GetChildAt(0);

            if (lw.FirstVisiblePosition == 0)
            {
                rrr = ddd.Top;
            }
            CustomListview.OnScrollChanged(Source, new Controls.Actions.ScrollChangedEventArgs(0, 0, 0, rrr));
        }
Ejemplo n.º 10
0
 void HandleScroll(object sender, AbsListView.ScrollEventArgs e)
 {
     if (loading ||
         e.FirstVisibleItem + e.VisibleItemCount + 1 < e.TotalItemCount ||
         !hasNextPage)
     {
         return;
     }
     loading = true;
     DoFetch();
 }
Ejemplo n.º 11
0
        private void Listview_Scroll(object sender, AbsListView.ScrollEventArgs e)
        {
            var listview = sender as ListView;
            var adapter  = listview.Adapter as ArticleThreadAdapter;

            var firstIndex         = e.FirstVisibleItem;
            var visibleCount       = e.VisibleItemCount;
            var lastShownItemIndex = firstIndex + visibleCount;

            System.Diagnostics.Debug.WriteLine(listview.LastVisiblePosition + "\t@@@\t" + firstIndex + "\t" + visibleCount);
        }
Ejemplo n.º 12
0
 private void Control_Scroll(object sender, AbsListView.ScrollEventArgs e)
 {
     if (e.FirstVisibleItem != _prevFirstVisibleElement && _myListView != null)
     {
         var direction = e.FirstVisibleItem > _prevFirstVisibleElement ? MyListView.ScrollToEnd : MyListView.ScrollToStart;
         _myListView.LastScrollDirection = direction;
         _myListView.AtStartOfList       = (e.FirstVisibleItem == 0);
         _myListView.AtEndOfList         = (e.FirstVisibleItem + 1 + e.VisibleItemCount >= e.TotalItemCount);
         _prevFirstVisibleElement        = e.FirstVisibleItem;
     }
 }
Ejemplo n.º 13
0
 private void Control_Scroll(object sender, AbsListView.ScrollEventArgs e)
 {
     if (e.FirstVisibleItem != _prevFirstVisibleElement && Element is MyListView)
     {
         var direction = e.FirstVisibleItem > _prevFirstVisibleElement ? MyListView.ScrollToEnd : MyListView.ScrollToStart;
         var myList    = Element as MyListView;
         myList.LastScrollDirection = direction;
         myList.AtStartOfList       = (e.FirstVisibleItem == 0);
         _prevFirstVisibleElement   = e.FirstVisibleItem;
     }
 }
 private void Control_Scroll(object sender, AbsListView.ScrollEventArgs e)
 {
     if (e.FirstVisibleItem + e.VisibleItemCount == e.TotalItemCount)
     {
         var s = DateTime.UtcNow;
         if ((s - lastScroll).TotalMilliseconds > 500)
         {
             ((IOverScrollView)Element).InvokeOverScrolled();
         }
         lastScroll = s;
     }
 }
Ejemplo n.º 15
0
        void HandleScroll(object sender, AbsListView.ScrollEventArgs e)
        {
            lastVisibleItem = e.FirstVisibleItem + e.VisibleItemCount;

            if (!isLoading && currentAdapter.ReflectionFeed.pagination != null && (currentAdapter.ReflectionFeed.pagination.next_cursor > 0) && (lastVisibleItem == e.TotalItemCount))
            {
                isLoading = true;
                currentList.AddFooterView(loadingView);
//				loadingView.Visibility = ViewStates.Visible;
                Task.Run(async() => GetMoreFeeds());
            }
        }
        private void ListView_Scroll(object sender, AbsListView.ScrollEventArgs e)
        {
            if (e.FirstVisibleItem > mPreviousVisibleItem)
            {
                fab.Hide(true);
            }
            else if (e.FirstVisibleItem < mPreviousVisibleItem)
            {
                fab.Show(true);
            }

            mPreviousVisibleItem = e.FirstVisibleItem;
        }
Ejemplo n.º 17
0
        private async void _control_Scroll(object sender, AbsListView.ScrollEventArgs e)
        {
            var c       = _control.GetChildAt(0);
            var scrolly = -c.Top + _control.FirstVisiblePosition * c.Height;

            if (scrolly < 20)
            {
                await Task.Delay(250);
            }

            // TODO: When scrolls to down we should animate toolbar to top together with layout
            // NavigationPage.SetHasNavigationBar(page.CurrentPage, !(scrolly > 20));
        }
Ejemplo n.º 18
0
 private void KeepScrollingInfinitely(object sender, AbsListView.ScrollEventArgs args)
 {
     lock (_scrollLockObject)
     {
         var mustLoadMore = args.FirstVisibleItem + args.VisibleItemCount >= args.TotalItemCount - LoadNextItemsThreshold;
         if (mustLoadMore && _mySimpleItemLoader.CanLoadMoreItems && !_mySimpleItemLoader.IsBusy)
         {
             _mySimpleItemLoader.IsBusy = true;
             Log.Info(TAG, "Requested to load more items");
             _mySimpleItemLoader.LoadMoreItems(ItemsPerPage);
             _gridviewAdapter.NotifyDataSetChanged();
             _gridView.InvalidateViews();
         }
     }
 }
Ejemplo n.º 19
0
		void OnListScroll (object sender, AbsListView.ScrollEventArgs e)
		{
			if (mReady) {
				char firstLetter = mStrings[e.FirstVisibleItem][0];

				if (!mShowing && firstLetter != mPrevLetter) {
					mShowing = true;
					mDialogText.Visibility = ViewStates.Visible;
				}

				mDialogText.Text = firstLetter.ToString ();
				mHandler.RemoveCallbacks (mRemoveWindow);
				mHandler.PostDelayed (mRemoveWindow, 3000);
				mPrevLetter = firstLetter;
			}
		}
Ejemplo n.º 20
0
        private void ListView_Scroll(object sender, AbsListView.ScrollEventArgs e)
        {
            if (this.hideFab)
            {
                return;
            }

            if (e.FirstVisibleItem > previousVisibleItem)
            {
                fab.Hide(true);
            }
            else if (e.FirstVisibleItem < previousVisibleItem)
            {
                fab.Show(true);
            }

            previousVisibleItem = e.FirstVisibleItem;
        }
        private void Control_Scroll(object sender, AbsListView.ScrollEventArgs e)
        {
            if (e.FirstVisibleItem != _prevFirstVisibleElement && _myListView != null)
            {
                var direction = e.FirstVisibleItem > _prevFirstVisibleElement ? ExtendedListView.ScrollToEnd : ExtendedListView.ScrollToStart;
                _myListView.LastScrollDirection = direction;
                _myListView.AtStartOfList       = (e.FirstVisibleItem == 0);
                _myListView.AtEndOfList         = (e.FirstVisibleItem + 1 + e.VisibleItemCount >= e.TotalItemCount);
                _prevFirstVisibleElement        = e.FirstVisibleItem;
            }
            var items = _myListView.ItemsSource as IEnumerable <object>;

            if (items != null && items.Count() > e.FirstVisibleItem)
            {
                _myListView.FirstVisibleItem = items.ElementAt(e.FirstVisibleItem);
            }
            _myListView.FirstVisibleItemIndex = e.FirstVisibleItem;
        }
Ejemplo n.º 22
0
        /// <summary>
        /// Handles the scroll.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="AbsListView.ScrollEventArgs"/> instance containing the event data.</param>
        void HandleScroll(object sender, AbsListView.ScrollEventArgs e)
        {
            //if (_scrollDistance <= 1) {
            //	_searchBarIsVisible = true;        // HandleScroll gets called when the view is created, which causes search bar to be removed
            //	_isScrollingDown = true;
            //	_scrollDistance = _searchText.Height;
            //}

            //if (_isScrollingDown) {
            //	if (!_searchBarIsVisible) {
            //		ShowSearchBar ();
            //	}
            //} else if (!_isScrollingDown) {
            //	if (_searchBarIsVisible) {
            //		HideSearchBar ();
            //	}
            //}
        }
        void Control_Scroll(object sender, AbsListView.ScrollEventArgs e)
        {
            int y = (int)(-e.View.GetChildAt(0).GetY() / 2);

            if (y == lastY)
            {
                return;
            }

            if (e.FirstVisibleItem == 0 && y <= 255 && y >= 0)
            {
                CustomNavigationPage.SetBarBackgroundColor(Color.FromRgba(255, 80, 80, lastY = y));
            }
            else if (e.FirstVisibleItem != 0 && Math.Abs(lastY - 1) > double.Epsilon)
            {
                CustomNavigationPage.SetBarBackgroundColor(Color.FromRgba(255, 80, 80, lastY = 255));
            }
        }
Ejemplo n.º 24
0
        private async void OnNotesListScroll(object sender, AbsListView.ScrollEventArgs e)
        {
            // Prevenir cargar notas precipitadamente.
            NotesList.Scroll -= OnNotesListScroll;

            try
            {
                // Cargar notas solo si se ha llegado al final de la lista.
                bool more = e.FirstVisibleItem + e.VisibleItemCount >= e.TotalItemCount;

                if (more)
                {
                    ProgressDialog dialog = new ProgressDialog(this);
                    dialog.SetMessage("Cargando notas");
                    dialog.SetCancelable(false);
                    dialog.SetCanceledOnTouchOutside(false);
                    dialog.Show();

                    List <NoteItem> notes = await DibbiData.GetNotes(Notes[Notes.Count - 1].CreatedAt);

                    Notes.AddRange(notes);
                    NotesAdapter.NotifyDataSetChanged();

                    // Cargar más notas posteriormente solo si quedan más.
                    if (notes.Count == 20)
                    {
                        NotesList.Scroll += OnNotesListScroll;
                    }

                    await Task.Delay(1000);

                    dialog.Dismiss();
                    dialog.Dispose();
                }
                else
                {
                    NotesList.Scroll += OnNotesListScroll;
                }
            }
            catch (Exception err)
            {
                throw err;
            }
        }
        private void Target_Scroll(object sender, AbsListView.ScrollEventArgs e)
        {
            if (e.TotalItemCount <= 0 || (e.TotalItemCount - e.FirstVisibleItem >= 4 && e.VisibleItemCount + e.FirstVisibleItem < e.TotalItemCount))
            {
                return;
            }

            if (this.command == null)
            {
                return;
            }

            if (!this.command.CanExecute(null))
            {
                return;
            }

            this.command.Execute(null);
        }
Ejemplo n.º 26
0
        void HandleScroll(object sender, AbsListView.ScrollEventArgs e)
        {
            var h = headerView.Height - Activity.ActionBar.Height - floatingHeader.Height;
//			if (headerView != null) {
//				if ((tableHeader.Top + headerView.Top) < 110) {
//					floatingHeader.Visibility = ViewStates.Visible;
//				} else {
//					floatingHeader.Visibility = ViewStates.Gone;
//				}
//			}

            float ratio    = (float)Math.Min(Math.Max(headerView.GetY() * -1, 0), h) / h;
            int   newAlpha = (int)(ratio * 255);

            if (actionBarBackgroundDrawable != null)
            {
                actionBarBackgroundDrawable.SetAlpha(newAlpha);
//				Activity.ActionBar.SetBackgroundDrawable (actionBarBackgroundDrawable);
            }
        }
        private void Control_Scroll(object sender, AbsListView.ScrollEventArgs e)
        {
            if (ControlEventHelper.IsFirstScrollAfterListViewChanged)
            {
                ControlEventHelper.IsFirstScrollAfterListViewChanged = false;
                return;
            }
            var action = Parallax.Helpers.ControlEventHelper.GetListViewScrollAction(this.Element);

            if (action == null)
            {
                return;
            }
            else if (Control.ChildCount == 0)
            {
                return;
            }
            var c = Control.GetChildAt(0);

            action(Element, Control.FirstVisiblePosition, Resources.DisplayMetrics.Density, 0, c.Top);
        }
Ejemplo n.º 28
0
        private void M_listview_Scroll(object sender, AbsListView.ScrollEventArgs e)
        {
            try
            {
                if (e.TotalItemCount <= 0)
                {
                    return;
                }

                //If the listview is scrolled to bottom, dismiss andHUD (this is the end of the activity initialization)
                int iLastItemShownOnScreen = e.FirstVisibleItem + e.VisibleItemCount;

                if (iLastItemShownOnScreen == e.TotalItemCount)
                {
                    AndHUD.Shared.Dismiss();
                }
            }
            catch (Exception ex)
            {
                MobileCenter_Helper.ReportError(new FileAccessManager(), ex, GetType().Name, MethodBase.GetCurrentMethod().Name);
            }
        }
        private async void MListView_Scroll(object sender, AbsListView.ScrollEventArgs e)
        {
            if (_isBusy)
            {
                return;
            }
            var list = sender as ListView;
            var lastIndexInScreen = e.VisibleItemCount + e.FirstVisibleItem;

            if (lastIndexInScreen >= e.TotalItemCount)
            {
                _isBusy = true;
                DisplayProgressBar(true);

                await Task.Delay(2000);

                BindNextItems();
                DisplayProgressBar(false);
                _isBusy = false;
            }
            ;
        }
Ejemplo n.º 30
0
        private void OnIndexListScroll(object sender, AbsListView.ScrollEventArgs e)
        {
            var index = indexListAdaptor[e.FirstVisibleItem];

            SetIndexIndicator(index == null ? ' ' : index.Title[0]);
        }