当前位置: 首页>>代码示例>>C#>>正文


C# RecyclerView.GetAdapter方法代码示例

本文整理汇总了C#中RecyclerView.GetAdapter方法的典型用法代码示例。如果您正苦于以下问题:C# RecyclerView.GetAdapter方法的具体用法?C# RecyclerView.GetAdapter怎么用?C# RecyclerView.GetAdapter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RecyclerView的用法示例。


在下文中一共展示了RecyclerView.GetAdapter方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnInterceptTouchEvent

        public bool OnInterceptTouchEvent (RecyclerView rv, MotionEvent e)
        {
            // TODO : this part intercep any touch inside recycler
            // and delete pending items.
            // A better method could be used.

            if (e.Action == MotionEventActions.Down) {
                var undoAdapter = (IUndoAdapter)rv.GetAdapter ();
                View view = GetChildViewUnder (e);

                if (view == null) {
                    undoAdapter.DeleteSelectedItem ();
                } else {
                    int position = recyclerView.GetChildLayoutPosition (view);
                    if (!undoAdapter.IsUndo (position)) {
                        undoAdapter.DeleteSelectedItem ();
                    }
                }
            }

            if (IsEnabled) {
                gestureDetector.OnTouchEvent (e);
            }
            return false;
        }
开发者ID:eatskolnikov,项目名称:mobile,代码行数:25,代码来源:ItemTouchListener.cs

示例2: OnScrolled

        public override void OnScrolled(RecyclerView recyclerView, int dx, int dy)
        {
            base.OnScrolled (recyclerView, dx, dy);

            var visibleItemCount = recyclerView.ChildCount;
            var totalItemCount = recyclerView.GetAdapter().ItemCount;
            var pastVisiblesItems = LayoutManager.FindFirstVisibleItemPosition();

            if ((visibleItemCount + pastVisiblesItems) >= totalItemCount) {
                LoadMoreEvent (this, totalItemCount);
            }
        }
开发者ID:benoitjadinon,项目名称:BlueMarin,代码行数:12,代码来源:RecyclerViewOnScrollListener.cs

示例3: OnScrolled

		public override void OnScrolled (RecyclerView recyclerView, int dx, int dy)
		{

			base.OnScrolled (recyclerView, dx, dy);

			var visibleItemCount = recyclerView.ChildCount;
			//			Console.Error.WriteLine ("isRefeshing"+MySoal_Tab_1.isRefeshing);
			//
			if (MyHealth_Tab_2.isRefreshing) {
				Console.Error.WriteLine ("masuk");
				MyHealth_Tab_2.worker.CancelAsync ();

				if (MyHealth_Tab_2.worker.CancellationPending) { 
					if (MyHealth_Tab_2.worker.IsBusy == true)
					{

					}				
				}			
			}

			var totalItemCount = recyclerView.GetAdapter().ItemCount;
			var lastVisibleItem = ((LinearLayoutManager)recyclerView.GetLayoutManager()).FindLastCompletelyVisibleItemPosition();

			if ((lastVisibleItem+1) == totalItemCount) {
				Console.Error.WriteLine ("scrolll222");

				LoadMoreEvent (this, null);
			}
		}
开发者ID:kktanpiya,项目名称:pyongPyaa048,代码行数:29,代码来源:Takwim_RecyclerViewAdapter.cs

示例4: OnScrolled

            public override void OnScrolled(RecyclerView recyclerView, int dx, int dy)
            {
                View firstVisibleView 	= recyclerView.GetChildAt(0);
                int firstVisiblePosition = recyclerView.GetChildPosition(firstVisibleView);
                int visibleRange 		= recyclerView.ChildCount;
                int lastVisiblePosition = firstVisiblePosition + visibleRange;
                int itemCount 			= recyclerView.GetAdapter().ItemCount;
                int position;

                if(firstVisiblePosition==0)
                    position=0;
                else if(lastVisiblePosition==itemCount-1)
                    position = itemCount-1;
                else
                    position = firstVisiblePosition;

                float proportion=(float)position/(float)itemCount;
                this.scroll.setPosition(scroll.height*proportion);
            }
开发者ID:dbeattie71,项目名称:FastScroll,代码行数:19,代码来源:FastScroller.cs

示例5: OnScrolled

			public override void OnScrolled (RecyclerView recyclerView, int dx, int dy)
			{
				base.OnScrolled (recyclerView, dx, dy);

				var visibleItemCount = recyclerView.ChildCount;

				var totalItemCount = recyclerView.GetAdapter().ItemCount;
				var lastVisibleItem = ((LinearLayoutManager)recyclerView.GetLayoutManager()).FindLastCompletelyVisibleItemPosition();

				if ((lastVisibleItem+1) == totalItemCount) {
					LoadMoreEvent (this, null);
				}
			}
开发者ID:kktanpiya,项目名称:kimuraHazuki048,代码行数:13,代码来源:MyVoteMAPOAdapter.cs

示例6: OnScrolled

		public override void OnScrolled (RecyclerView recyclerView, int dx, int dy)
		{
			pref = PreferenceManager.GetDefaultSharedPreferences(Application.Context);
			LinearLayoutManager linearLayoutManager = (LinearLayoutManager)recyclerView.GetLayoutManager ();
			int lastVisibleItem = linearLayoutManager.FindLastVisibleItemPosition();
			int totalItemCount = recyclerView.GetAdapter().ItemCount;

			if (!IsLoading && totalItemCount <= (lastVisibleItem + visibleThreshold)) {
				// End has been reached
				// Do something
				var currPrefPage = pref.GetString ("CurrentPage", string.Empty);
				if (!String.IsNullOrEmpty (currPrefPage)) {
					if (Int32.Parse (currPrefPage) > 0) {
						currentPage++;
					} else {
						currentPage = 2;
					}
				} else {
					currentPage++;

				}
				var editor = pref.Edit();
				editor.PutString("CurrentPage",currentPage.ToString());
				editor.Apply();

				IsLoading = true;
				Task.Factory.StartNew (async () => {
					
					try{
						var newPostList = new List<Post>();
						await WebClient.LoadPosts(newPostList,currentPage);


						(recyclerView.GetAdapter()as PostViewAdapter)._Posts.AddRange(newPostList);
						//recyclerView.GetAdapter().HasStableIds = true;

						_messageShown = false;
						Application.SynchronizationContext.Post (_ => {recyclerView.GetAdapter().NotifyDataSetChanged();}, null);
						//recyclerView.GetAdapter().NotifyItemRangeInserted(recyclerView.GetAdapter().ItemCount,newPostList.Count);
					}catch(Exception ex){
						//Insights.Report(ex,new Dictionary<string,string>{{"Message",ex.Message}},Insights.Severity.Error);
						var text = ex.Message;
						if(!_messageShown){
							Application.SynchronizationContext.Post (_ => {
								Toast.MakeText(Application.Context,"При загрузке данных произошла ошибка",ToastLength.Short).Show();
							}, null);
							_messageShown = true;
						}

					}


					IsLoading = false;
				});

			}
		}
开发者ID:takigava,项目名称:pikabu,代码行数:57,代码来源:PostViewAdapter.cs

示例7: CanDismiss

 public bool CanDismiss (RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder)
 {
     var adapter = recyclerView.GetAdapter ();
     return adapter.GetItemViewType (viewHolder.LayoutPosition) == RecyclerCollectionDataAdapter<IHolder>.ViewTypeContent;
 }
开发者ID:MrBloo63,项目名称:mobile,代码行数:5,代码来源:LogTimeEntriesListFragment.cs

示例8: CanRecyclerViewScroll

        public static bool CanRecyclerViewScroll(RecyclerView view)
        {
            if (view == null || view.GetAdapter() == null || view.GetLayoutManager() == null)
                return false;
            RecyclerView.LayoutManager lm = view.GetLayoutManager();
            int count = view.GetAdapter().ItemCount;
            int lastVisible;

            if (lm is LinearLayoutManager)
            {
                LinearLayoutManager llm = (LinearLayoutManager)lm;
                lastVisible = llm.FindLastVisibleItemPosition();
            }
            else
            {
                throw new InvalidOperationException("Material Dialogs currently only supports LinearLayoutManager. Please report any new layout managers.");
            }

            if (lastVisible == -1)
                return false;

            bool lastItemVisible = lastVisible == count - 1;
            return !lastItemVisible ||
                    (view.ChildCount > 0 && view.GetChildAt(view.ChildCount - 1).Bottom > view.Height - view.PaddingBottom);
        }
开发者ID:devxiaruwei,项目名称:MaterialDialogs,代码行数:25,代码来源:MDRootLayout.cs

示例9: CanDismiss

 public bool CanDismiss (RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder)
 {
     var adapter = recyclerView.GetAdapter ();
     return adapter.GetItemViewType (viewHolder.LayoutPosition) == LogTimeEntriesAdapter.ViewTypeContent;
 }
开发者ID:ZhangLeiCharles,项目名称:mobile,代码行数:5,代码来源:LogTimeEntriesListFragment.cs


注:本文中的RecyclerView.GetAdapter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。