private void InitComponents() { toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); //Movie RecyclerView var mvxRecyclerView = FindViewById <MvxRecyclerView>(Resource.Id.search_layout_recyclerview); var layoutManager = new GridLayoutManager(this, 2); var adapter = new SearchViewRecyclerAdapter((IMvxAndroidBindingContext)BindingContext); mvxRecyclerView.AddItemDecoration(new GridSpacingItemDecoration(2, 16, true, 0)); searchEditText = FindViewById <EditText>(Resource.Id.search_bar_edit_text); searchEditText.AddTextChangedListener(this); searchEditText.Typeface = FontUtils.GetNormalFont(this); //Infinite Scrolling var onScrollListener = new EndlessRecyclerOnScrollListener(); onScrollListener.LoadMoreEvent += (object sender, EventArgs e) => { ViewModel.LoadMoreDataCommand.Execute(true); }; mvxRecyclerView.AddOnScrollListener(onScrollListener); mvxRecyclerView.SetLayoutManager(layoutManager); mvxRecyclerView.Adapter = adapter; RecyclerView.ItemAnimator animator = mvxRecyclerView.GetItemAnimator(); if (animator is DefaultItemAnimator) { ((DefaultItemAnimator)animator).SupportsChangeAnimations = false; } }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { var rootView = inflater.Inflate(Resource.Layout.RecyclerViewFragment, container, false); RecyclerView = rootView.FindViewById <RecyclerView> (Resource.Id.recyclerView); LayoutManager = GetLayoutManager(); RecyclerView.SetLayoutManager(LayoutManager); ItemAnimator = GetItemAnimator(); RecyclerView.SetItemAnimator(ItemAnimator); SwipeRefreshLayout = rootView.FindViewById <SwipeRefreshLayout> (Resource.Id.swipe_refresh_layout); if (EnablePullToRefresh) { SwipeRefreshLayout.SetOnRefreshListener(this); } //adds item divider lines if ShowDividers == true if (ShowDividers) { RecyclerView.AddItemDecoration(new DividerItemDecoration(Activity, DividerItemDecoration.VerticalList)); } Adapter = TypedAdapter = CreateAdapter(); RecyclerView.ScrollToPosition(0); RecyclerView.SetAdapter(Adapter); //start to load the data that will populate the RecyclerView loadData(); return(rootView); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); System.Console.WriteLine("AnnotationActivity >> OnCreate"); app = this; try { if (FindViewById(Resource.Id.lines) != null) { AnnTask.UpdateVars(this); CheckIsShared(); return; } curFilePath = ""; isFirstAnnotation = true; isFirstFileAnnotation = true; PreferenceManager.SetDefaultValues(this, Resource.Xml.preferences, false); sharedPrefs = PreferenceManager.GetDefaultSharedPreferences(this); SetContentView(Resource.Layout.MainActivity); mToolbar = (Toolbar)FindViewById(Resource.Id.toolbar); // Attaching the layout to the toolbar object SetSupportActionBar(mToolbar); SupportActionBar.SetDisplayShowHomeEnabled(true); SupportActionBar.SetIcon(Resource.Drawable.logo_toolbar); wPopup = new WordPopup(this); testView = new LineView(this); testView.UpdateVars(); lines = new List <List <object> >(); linesRecyclerView = (CustomRecyclerView)FindViewById(Resource.Id.lines); linesRecyclerView.mMainActivity = this; linesLayoutManager = new LinearLayoutManager(this); linesRecyclerView.SetLayoutManager(linesLayoutManager); linesAdapter = new AnnListAdapter(this, this.lines, linesRecyclerView, wPopup); linesRecyclerView.SetAdapter(linesAdapter); defaultItemAnimator = linesRecyclerView.GetItemAnimator(); linesRecyclerView.AddOnScrollListener(new RecyclerViewOnScrollListener(this)); mBookmarks = new List <Bookmark>(); mFoundBookmarks = new List <Bookmark>(); } catch (Exception e) { Toast.MakeText(this, "Error: " + e.Message, ToastLength.Long).Show(); } }