public StickyHeaderRecyclerView(Context context, View header, int minHeightHeader, HeaderAnimator headerAnimator, RecyclerView recyclerView, bool preventTouchBehindHeader) : base(context, header, recyclerView, minHeightHeader, headerAnimator, preventTouchBehindHeader) { SetupItemDecorator(); // scroll events recyclerView.AddOnScrollListener(new RecyclerScrollListener(this)); }
protected async override void OnCreate(Bundle savedInstanceState) { base.OnCreate (savedInstanceState); SetContentView (Resource.Layout.MyShop_listall_fragment_list); var toolbar = FindViewById<V7Toolbar>(Resource.Id.toolbar); SetSupportActionBar (toolbar); toolbar.SetBackgroundColor (Color.ParseColor ("#9C27B0")); SupportActionBar.SetDisplayHomeAsUpEnabled (true); SupportActionBar.SetDisplayShowHomeEnabled (true); mRecyclerView = FindViewById <RecyclerView> (Resource.Id.recyclerView); progressBar = FindViewById <ProgressBar> (Resource.Id.pbHeaderProgress); llMyShopErrorLayout = (LinearLayout)FindViewById (Resource.Id.llMyShopErrorLayout); currentPage = 1; string action_type = Intent.GetStringExtra ("action_type"); //run setupdata and get title e.g:search,latest product etc var title = await Task.Factory.StartNew(() => setupData(currentPage , action_type)); Title = title; if (mRecyclerView != null) { mRecyclerView.HasFixedSize = true; var layoutManager = new LinearLayoutManager (this); var onScrollListener = new Product_RecyclerViewAdapter.ViewOnScrollListener (layoutManager); onScrollListener.LoadMoreEvent += (object sender, EventArgs e) => { currentPage++; if (currentPage <= lastPage) { ThreadPool.QueueUserWorkItem (o => { setupData (currentPage , action_type); }); } }; mRecyclerView.AddOnScrollListener (onScrollListener); mRecyclerView.SetLayoutManager (layoutManager); } // var fab = FindViewById<FloatingActionButton> (Resource.Id.fab); // fab.Click += (sender, e) => { // Snackbar.Make (fab, "Here's a snackbar!", Snackbar.LengthLong).SetAction ("Action", // new ClickListener (v => { // Console.WriteLine ("Action handler"); // })).Show (); // // // }; }
public ItemTouchListener (RecyclerView recyclerView, IItemTouchListener listener) { if (recyclerView == null || listener == null) { throw new IllegalArgumentException ("RecyclerView and Listener arguments can not be null"); } IsScrolling = false; this.recyclerView = recyclerView; this.listener = listener; gestureDetector = new GestureDetector (recyclerView.Context, this); recyclerView.AddOnScrollListener (new RecyclerViewScrollDetector (this)); }
// Used by the renderer to maintain scroll offset when using ItemsUpdatingScrollMode KeepScrollOffset public void UndoNextScrollAdjustment() { // Don't start tracking the scroll offsets until we really need to if (!_maintainingScrollOffsets) { _maintainingScrollOffsets = true; _recyclerView.AddOnScrollListener(this); } _undoNextScrollAdjustment = true; _lastScrollX = _recyclerView.ComputeHorizontalScrollOffset(); _lastScrollY = _recyclerView.ComputeVerticalScrollOffset(); }
public override void OnViewCreated(View view, Bundle savedInstanceState) { if (IsInitialized) { return; } base.OnViewCreated(view, savedInstanceState); _searchView.Hint = AppSettings.LocalizationManager.GetText(LocalizationKeys.SearchHint); _searchView.SetFilters(new IInputFilter[] { new TextInputFilter(TextInputFilter.TagFilter) }); _tagsButton.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.Tag); _peopleButton.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.Users); _clearButton.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.Clear); _emptyQueryLabel.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.EmptyQuery); _searchView.TextChanged += OnSearchViewOnTextChanged; _categories.SetLayoutManager(new LinearLayoutManager(Activity)); _users.SetLayoutManager(new LinearLayoutManager(Activity)); _searchFacade.UserFriendPresenter.SourceChanged += UserFriendPresenterSourceChanged; _searchFacade.TagsPresenter.SourceChanged += TagsPresenterSourceChanged; _categoriesAdapter = new BrowseSearchTagsAdapter(_searchFacade.TagsPresenter); _usersSearchAdapter = new FollowersAdapter(Activity, _searchFacade.UserFriendPresenter); _categories.SetAdapter(_categoriesAdapter); _users.SetAdapter(_usersSearchAdapter); _scrollListner = new ScrollListener(); _scrollListner.ScrolledToBottom += GetTags; _users.AddOnScrollListener(_scrollListner); _categoriesAdapter.Click += OnClick; _usersSearchAdapter.UserAction += OnClick; _usersSearchAdapter.FollowAction += Follow; _timer = new Timer(OnTimer); _searchView.Typeface = Style.Regular; _clearButton.Typeface = Style.Regular; _clearButton.Visibility = ViewStates.Gone; _clearButton.Click += OnClearClick; _tagsButton.Click += TagsClick; _peopleButton.Click += PeopleClick; SwitchSearchType(false); _searchView.RequestFocus(); ((BaseActivity)Activity).OpenKeyboard(_searchView); _emptyQueryLabel.Typeface = Style.Light; _emptyQueryLabel.Visibility = ViewStates.Invisible; }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { var view = inflater.Inflate(Resource.Layout.WishList_Fragment, container, false); HasOptionsMenu = true; paginationModel.Status = 0; // 0 = WishList , 1 = Read , 2 = All mRecyclerView = view.FindViewById <RecyclerView>(Resource.Id.WishListBookList); if (mRecyclerView != null) { mRecyclerView.HasFixedSize = true; var layoutManager = new LinearLayoutManager(this.Context); var onScrollListener = new XamarinRecyclerViewOnScrollListener(layoutManager); onScrollListener.LoadMoreEvent += (object sender, bool loadCalled) => { if (loadCalled) { if (loadList) { Toast.MakeText(this.Context, "Loading More Books...", ToastLength.Long).Show(); if (InternetConnectivityModel.CheckConnection(this.Context)) { LoadMoreBooks(); } else { LoadMoreBooksOffline(); } } } }; mRecyclerView.AddOnScrollListener(onScrollListener); mRecyclerView.SetLayoutManager(layoutManager); } paginationModel.SkipRecords = 0; FloatingActionButton fabAddBook = view.FindViewById <FloatingActionButton>(Resource.Id.fabAddBook); fabAddBook.Click += FabAddBook_Click; if (InternetConnectivityModel.CheckConnection(this.Context)) { LoadServerBooks(); } else { paginationModel.SkipRecords = 0; paginationModel.TakeRecords = 30; loadBookAdapter(); } return(view); }
private async Task Refresh() { try { RecyclerView recycler = view.FindViewById <RecyclerView>(Resource.Id.recycler_view_videos); ProgressBar progress = view.FindViewById <ProgressBar>(Resource.Id.progress_load); TextView text = view.FindViewById <TextView>(Resource.Id.text_loading); ProgressBar loadMoreBar = view.FindViewById <ProgressBar>(Resource.Id.load_more); recycler.RemoveAllViewsInLayout(); progress.Visibility = ViewStates.Visible; pageNumber = 1; if (videos != null) { videos.Clear(); } await LoadVideos(); if (videos != null && videos.Count > 0) { LinearLayoutManager layoutManager = new LinearLayoutManager(view.Context); recycler.SetLayoutManager(layoutManager); OnScrollListener onScrollListener = new OnScrollListener(layoutManager); recycler.AddOnScrollListener(onScrollListener); VideoAdapter adapter = new VideoAdapter(videos); adapter.ItemClick += Adapter_ItemClick; adapter.ItemLongClick += Adapter_ItemLongClick; recycler.SetAdapter(adapter); onScrollListener.LoadMoreEvent += async delegate { loadMoreBar.Visibility = ViewStates.Visible; await LoadVideos(); adapter.NotifyDataSetChanged(); loadMoreBar.Visibility = ViewStates.Gone; }; } recycler.Visibility = ViewStates.Visible; progress.Visibility = ViewStates.Gone; text.Visibility = ViewStates.Gone; } catch { await Refresh(); } }
private void SetUpRecyclerView(RecyclerView _recyclerView) { //Create our layout manager _recyclerView.AddItemDecoration(horizontalDecoration); recyclerView.HasFixedSize = true; var layoutManager = new LinearLayoutManager(Activity); onScrollListener = new XamarinRecyclerViewOnScrollListener(layoutManager); onScrollListener.LoadMoreEvent += OnScrollListener_LoadMoreEventAsync; onScrollListener.OnHide += OnScrollListener_OnHide; onScrollListener.OnShow += OnScrollListener_OnShow; recyclerView.AddOnScrollListener(onScrollListener); recyclerView.SetLayoutManager(layoutManager); }
private void SetRecyclerViewAdapters() { try { PixUserFeedAdapter = new UserPostAdapter(Activity); var mLayoutManager = new GridLayoutManager(Activity, 3); ProfileFeedRecylerView.SetLayoutManager(mLayoutManager); ProfileFeedRecylerView.AddItemDecoration(new GridSpacingItemDecoration(1, 1, true)); var sizeProvider = new FixedPreloadSizeProvider(10, 10); var preLoader = new RecyclerViewPreloader <PostsObject>(Activity, PixUserFeedAdapter, sizeProvider, 8); ProfileFeedRecylerView.AddOnScrollListener(preLoader); ProfileFeedRecylerView.SetAdapter(PixUserFeedAdapter); RecyclerViewOnScrollListener xamarinRecyclerViewOnScrollListener = new RecyclerViewOnScrollListener(mLayoutManager); MainScrollEvent = xamarinRecyclerViewOnScrollListener; MainScrollEvent.LoadMoreEvent += OnScroll_OnLoadMoreEvent; ProfileFeedRecylerView.AddOnScrollListener(xamarinRecyclerViewOnScrollListener); MainScrollEvent.IsLoading = false; } catch (Exception e) { Console.WriteLine(e); } }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.Inflate(Resource.Layout.FillWeldLog, container, false); mFragmentContainer = this.Activity.FindViewById <FrameLayout>(Resource.Id.fragmentContainer); act = (AppCompatActivity)this.Activity; mToolbar = act.FindViewById <SupportToolbar>(Resource.Id.toolbar); act.SetSupportActionBar(mToolbar); act.SupportActionBar.SetDisplayHomeAsUpEnabled(true); mToolbar.NavigationIcon.SetColorFilter(Color.ParseColor("#FFFFFF"), PorterDuff.Mode.SrcAtop); view.FindViewById <TextView>(Resource.Id.lbliProjNo).Text = _spl.iProjNo.ToString(); view.FindViewById <TextView>(Resource.Id.lblcISO).Text = _spl.cISO.Trim(); view.FindViewById <TextView>(Resource.Id.lblcSpoolNo).Text = _spl.cSpoolNo.Trim(); txtWeldDate = view.FindViewById <EditText>(Resource.Id.txtWeldDate); _dWeld = DateTime.Now; txtWeldDate.Text = _dWeld.ToString("dd/MM/yyyy"); txtWeldDate.Click += (sender, e) => { CultureInfo provider = CultureInfo.InvariantCulture; DateTime dateTime = DateTime.ParseExact(txtWeldDate.Text, "dd/MM/yyyy", provider); DatePickerDialog datePicker = new DatePickerDialog(this.Context, this, dateTime.Year, dateTime.Month - 1, dateTime.Day); DateTime baseDate = new DateTime(1970, 1, 1); TimeSpan diff = DateTime.Now - baseDate; datePicker.DatePicker.MaxDate = (long)diff.TotalMilliseconds; datePicker.Show(); }; txtWeldDate.AfterTextChanged += (sender, e) => { fill_list(); }; btnSubmitWeldLog = view.FindViewById <Button>(Resource.Id.btnSubmitWeldLog); btnSubmitWeldLog.Click += BtnSubmitWeldLog_Click; rv = view.FindViewById <RecyclerView>(Resource.Id.mRecylcerID); rv.SetLayoutManager(new GridLayoutManager(act, 1)); rv.SetItemAnimator(new DefaultItemAnimator()); rv.AddOnScrollListener(new CustomScrollListener()); fill_list(); return(view); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.Inflate(Resource.Layout.assignment, container, false); mFragmentContainer = this.Activity.FindViewById <FrameLayout>(Resource.Id.fragmentContainer); act = (AppCompatActivity)this.Activity; _swipeRefresh = view.FindViewById <SwipeRefreshLayout>(Resource.Id.swiperefresh); rv = view.FindViewById <RecyclerView>(Resource.Id.mRecylcerID); rv.SetLayoutManager(new GridLayoutManager(act, 2)); rv.SetItemAnimator(new DefaultItemAnimator()); rv.AddOnScrollListener(new CustomScrollListener()); _swipeRefresh.Refresh += _swipeRefresh_Refresh; return(view); }
public RecyclerViewVerseViewAdapter(Context context, RecyclerView recyclerView, LinearLayoutManager layoutManager, int chapterHeadingVerseOffset) { _recyclerView = recyclerView; _layoutManager = layoutManager; _chapterHeadingVerseOffset = chapterHeadingVerseOffset; _scrollListener = new RecyclerViewScrollListener(); _scrollListener.Scrolled += ScrollListenerOnScrolled; _recyclerView.AddOnScrollListener(_scrollListener); _swipeTouchListener = new SwipeTouchListener(context); _swipeTouchListener.OnDown += SwipeTouchListenerOnOnDown; _swipeTouchListener.OnSwipeLeft += SwipeTouchListenerOnOnSwipeLeft; _swipeTouchListener.OnSwipeRight += SwipeTouchListenerOnOnSwipeRight; _recyclerView.SetOnTouchListener(_swipeTouchListener); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.AddBooksToWishListlayout); var toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.app_bar); SetSupportActionBar(toolbar); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); SupportActionBar.SetTitle(Resource.String.AddBooksToWishList); paginationModel.Status = 2; mRecyclerView = FindViewById <RecyclerView>(Resource.Id.BookList); if (mRecyclerView != null) { mRecyclerView.HasFixedSize = true; var layoutManager = new LinearLayoutManager(this); var onScrollListener = new XamarinRecyclerViewOnScrollListener(layoutManager); onScrollListener.LoadMoreEvent += (object sender, bool loadCalled) => { if (loadCalled) { if (loadList) { Toast.MakeText(this, "Loading More Books...", ToastLength.Long).Show(); if (InternetConnectivityModel.CheckConnection(this)) { if (String.IsNullOrEmpty(paginationModel.SearchText)) { LoadMoreBooks(); } } else { // LoadMoreBooksOffline(); } } } }; mRecyclerView.AddOnScrollListener(onScrollListener); mRecyclerView.SetLayoutManager(layoutManager); } paginationModel.SkipRecords = 0; if (InternetConnectivityModel.CheckConnection(this, true)) { LoadServerBooks(); } }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view2 = inflater.Inflate(Resource.Layout.Findplayers, container, false); SupportToolbar toolBar = view2.FindViewById <SupportToolbar>(Resource.Id.toolbar); ((AppCompatActivity)this.Activity).SetSupportActionBar(toolBar); ((AppCompatActivity)this.Activity).SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_menu); ((AppCompatActivity)this.Activity).SupportActionBar.SetDisplayHomeAsUpEnabled(true); ((AppCompatActivity)this.Activity).SupportActionBar.Title = GetString(Resource.String.Findplayers_Title); mRecyclerView = view2.FindViewById <RecyclerView>(Resource.Id.recyclerview); int uri2 = Resource.Drawable.Icon2; GetRandomSubList(Lists.Friends.NickStrings, 2); // dodanie 30 obiektów do listy var mLayoutManager = new LinearLayoutManager(mRecyclerView.Context); var onScrollListener = new RecyclerViewOnScrollListener(mLayoutManager); mRecyclerView.AddOnScrollListener(onScrollListener); mRecyclerView.SetLayoutManager(mLayoutManager); mAdapter = new SimpleStringRecyclerViewAdapter(mRecyclerView.Context, list, uri2, view2, 1); mRecyclerView.SetAdapter(mAdapter); mRecyclerView.SetItemClickListener((rv, position, view) => { TextView mTxtView = view.FindViewById <TextView>(Resource.Id.text1); Context context = view2.Context; Intent intent = new Intent(context, typeof(Profile)); intent.PutExtra("Name", mTxtView.Text); context.StartActivity(intent); }); // Dodanie nowych obiektów do listy po dojechaniu na dó³ onScrollListener.LoadMoreEvent += (object sender, EventArgs e) => { //GetRandomSubList(Lists.Friends.NickStrings, 5); // generowanie i dodanie noeych obiektów //mAdapter.NotifyDataSetChanged(); }; return(view2); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { base.OnCreateView(inflater, container, savedInstanceState); View view = inflater.Inflate(Resource.Layout.fragment_message_list, null); var user = Newtonsoft.Json.JsonConvert.DeserializeObject <User>(Arguments.GetString("userData")); Activity.Title = user.FirstName + " " + user.LastName; viewModel = new MessageViewModel(user.ObjectId); sendBtn = view.FindViewById <Button>(Resource.Id.button_chatbox_send); chatbox = view.FindViewById <EditText>(Resource.Id.edittext_chatbox); recyclerView = view.FindViewById <RecyclerView>(Resource.Id.reyclerview_message_list); recyclerView.SetAdapter(adapter = new MessageListAdapter(Activity, viewModel)); recyclerView.SetLayoutManager(new LinearLayoutManager(Activity)); var onScrollListener = new RecyclerViewOnScrollListener(); onScrollListener.ScrolledDownEvent += (sender, e) => { HideKeyboard(); }; recyclerView.AddOnScrollListener(onScrollListener); viewModel.Messages.CollectionChanged += (sender, args) => { recyclerView.SmoothScrollToPosition(viewModel.Messages.Count - 1); }; sendBtn.Click += async(sender, e) => { if (chatbox.Text == "") { return; } await viewModel.SendMessageAsync(chatbox.Text); chatbox.Text = ""; HideKeyboard(); }; return(view); }
//Get Messages Local Or Api private void Get_Messages() { try { BeforeMessageId = "0"; MAdapter.Clear(); SqLiteDatabase dbDatabase = new SqLiteDatabase(); var localList = dbDatabase.GetMessagesList(UserDetails.UserId, Userid, BeforeMessageId); if (localList == "1") //Database.. Get Messages Local { MAdapter.BindEnd(); //Scroll Down >> ChatBoxRecylerView.ScrollToPosition(MAdapter.MessageList.Count - 1); SwipeRefreshLayout.Refreshing = false; SwipeRefreshLayout.Enabled = false; } else //Or server.. Get Messages Api { SwipeRefreshLayout.Refreshing = true; SwipeRefreshLayout.Enabled = true; SwipeRefreshLayout.SetProgressBackgroundColorSchemeColor(AppSettings.SetTabDarkTheme ? Color.ParseColor("#424242") : Color.ParseColor("#f7f7f7")); GetMessages_API(); } //Set Event Scroll RecyclerViewOnScrollListener onScrollListener = new RecyclerViewOnScrollListener(MLayoutManager, SwipeRefreshLayout); onScrollListener.LoadMoreEvent += Messages_OnScroll_OnLoadMoreEvent; ChatBoxRecylerView.AddOnScrollListener(onScrollListener); TaskWork = "Working"; //Run timer Timer = new Timer { Interval = AppSettings.MessageRequestSpeed, Enabled = true }; Timer.Elapsed += TimerOnElapsed_MessageUpdater; Timer.Start(); dbDatabase.Dispose(); } catch (Exception e) { Console.WriteLine(e); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.activity_main); homeContainer = FindViewById <RecyclerView>(Resource.Id.homeContainer); homeContainer.AddOnScrollListener(new RecyclerViewScrollListner()); homeContainer.SetLayoutManager(new LinearLayoutManager(this)); homeAdapter = new HomeAdapter(this, contents, SupportFragmentManager); homeContainer.SetAdapter(homeAdapter); PopulateHome(); Window.SetBackgroundDrawableResource(Resource.Drawable.full_white); }
public override void OnViewCreated(View view, Bundle savedInstanceState) { base.OnViewCreated(view, savedInstanceState); recyclerView = (RecyclerView)view.FindViewById(Resource.Id.recycler_view); complimentsSwitcher = (TextSwitcher)view.FindViewById(Resource.Id.ts_compliments); compliValuesSwitcher = (TextSwitcher)view.FindViewById(Resource.Id.ts_compliValues); fullNameTv = view.FindViewById <TextView>(Resource.Id.account_username_tv); drivingSinceTv = view.FindViewById <TextView>(Resource.Id.account_jointime_tv); settingsIv = view.FindViewById <ImageView>(Resource.Id.account_settings_iv); profileIv = view.FindViewById <_BaseCircleImageView>(Resource.Id.acount_profile_iv); ratingTv = view.FindViewById <TextView>(Resource.Id.account_counter_tv); ridesTv = view.FindViewById <TextView>(Resource.Id.account_counter2_tv); //recycler recyclerView.SetAdapter(sliderAdapter); recyclerView.HasFixedSize = true; recyclerView.AddOnScrollListener( new MyRvOnScrollListener( null, (rv, newState) => { if (newState == RecyclerView.ScrollStateIdle) { OnActiveCardChange(); } }) ); layoutManger = (CardSliderLayoutManager)recyclerView.GetLayoutManager(); recyclerView.SetLayoutManager(layoutManger); CardSnapHelper cardSnapHelper = new CardSnapHelper(); cardSnapHelper.AttachToRecyclerView(recyclerView); //switcher complimentsSwitcher.SetFactory(new TextSwitcherUtil(Resource.Style.ComplimentsTextView, false, Activity)); complimentsSwitcher.SetCurrentText(compliments[0]); compliValuesSwitcher.SetFactory(new TextSwitcherUtil(Resource.Style.CompliValuesTextView, false, Activity)); var settingsBtn = view.FindViewById <ImageView>(Resource.Id.account_settings_iv); settingsBtn.Click += SettingsBtn_Click; var qrBtn = view.FindViewById <ImageView>(Resource.Id.account_qr_iv); qrBtn.Click += QrBtn_Click; SetDb(); }
public override void OnViewCreated(View view, Bundle savedInstanceState) { if (IsInitialized) { return; } base.OnViewCreated(view, savedInstanceState); _isFollowers = Activity.Intent.GetBooleanExtra(IsFollowersExtra, false); Presenter.FollowType = _isFollowers ? FriendsType.Followers : FriendsType.Following; Presenter.SourceChanged += PresenterSourceChanged; var count = Activity.Intent.GetIntExtra(CountExtra, 0); _peopleCount.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.PeopleText, count); _username = Activity.Intent.GetStringExtra(UsernameExtra) ?? AppSettings.User.Login; _backButton.Visibility = ViewStates.Visible; _backButton.Click += GoBackClick; _switcher.Visibility = ViewStates.Gone; _settings.Visibility = ViewStates.Gone; _viewTitle.Text = Presenter.FollowType.GetDescription(); _viewTitle.Typeface = Style.Semibold; _peopleCount.Typeface = Style.Regular; _adapter = new FollowersAdapter(Activity, Presenter); _adapter.FollowAction += Follow; _adapter.UserAction += UserAction; var scrollListner = new ScrollListener(); scrollListner.ScrolledToBottom += LoadItems; _followersList.SetAdapter(_adapter); _followersList.SetLayoutManager(new LinearLayoutManager(Activity)); _followersList.AddOnScrollListener(scrollListner); _emptyQueryLabel.Typeface = Style.Light; _emptyQueryLabel.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.EmptyCategory); LoadItems(); }
private void InitPopularRecyclerView() { popularManager = new LinearLayoutManager(Activity, LinearLayoutManager.Horizontal, false); popular.SetLayoutManager(popularManager); popularAdapter = new ItemAdapter(viewModel.GetCachedPopular()); popular.SetAdapter(popularAdapter); var popularScrollListener = new ItemAdapterScollListener(popularManager); popularScrollListener.LoadMore += async delegate() { if (!viewModel.CanLoadMorePopular()) { return; } await viewModel.GetPopular().ConfigureAwait(false); }; popular.AddOnScrollListener(popularScrollListener); }
private void InitTopRatedRecyclerView() { topRatedManager = new LinearLayoutManager(Activity, LinearLayoutManager.Horizontal, false); topRated.SetLayoutManager(topRatedManager); topRatedAdapter = new ItemAdapter(viewModel.GetCachedTopRated()); topRated.SetAdapter(topRatedAdapter); var topRatedScrollListener = new ItemAdapterScollListener(topRatedManager); topRatedScrollListener.LoadMore += async delegate() { if (!viewModel.CanLoadMoreTopRated()) { return; } await viewModel.GetTopRated().ConfigureAwait(false); }; topRated.AddOnScrollListener(topRatedScrollListener); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); SetContentView(Resource.Layout.activity_main); _swipeRefresh = FindViewById <SwipeRefreshLayout>(Resource.Id.swipe_main); _swipeRefresh.SetColorScheme(Resource.Color.colorPrimary, Android.Resource.Color.HoloGreenDark, Android.Resource.Color.HoloBlueDark, Android.Resource.Color.HoloOrangeDark); _swipeRefresh.SetOnRefreshListener(this); _swipeRefresh.Post(() => { SeedData(); }); _recyclerView = FindViewById <RecyclerView>(Resource.Id.recycler_waifu); _recyclerView.HasFixedSize = true; gridLayoutManager = new GridLayoutManager(this, 2); _recyclerView.SetLayoutManager(gridLayoutManager); _recyclerView.AddOnScrollListener(new LoadMoreListener(this)); }
private void InitNowPlayingRecyclerView() { nowPlayingManager = new LinearLayoutManager(Activity, LinearLayoutManager.Horizontal, false); nowPlaying.SetLayoutManager(nowPlayingManager); nowPlayingAdapter = new ItemAdapter(viewModel.GetCachedNowPlaying()); nowPlaying.SetAdapter(nowPlayingAdapter); var nowPlayingScrollListener = new ItemAdapterScollListener(nowPlayingManager); nowPlayingScrollListener.LoadMore += async delegate() { if (!viewModel.CanLoadMoreNowPlaying()) { return; } await viewModel.GetNowPlaying().ConfigureAwait(false); }; nowPlaying.AddOnScrollListener(nowPlayingScrollListener); }
protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); SetContentView (Resource.Layout.MyVote_Main); progressDialog = ProgressDialog.Show (this, "Sila Tunggu", "Sedang Memuatkan..."); //initiliaze jsonvalue // MyVote_Data myVoteData = new MyVote_Data(); mRecyclerView = FindViewById <RecyclerView> (Resource.Id.recyclerView); var toolbar = FindViewById <Toolbar> (Resource.Id.toolbar); SetSupportActionBar (toolbar); var mLayoutManager = new LinearLayoutManager (this); mRecyclerView.SetLayoutManager (mLayoutManager); //error layout llMyPosterErrorLayout = (LinearLayout)FindViewById (Resource.Id.llMyPosterErrorLayout); tvMyPosterErrorLayout = (TextView)FindViewById (Resource.Id.tvMyPosterErrorLayout); setupMyVoteData (page); if (mRecyclerView != null ) { mRecyclerView.HasFixedSize = true; var layoutManager = new LinearLayoutManager (this); var onScrollListener = new MyVote.MyVoteMAPOAdapter.MyvoteRecyclerViewOnScrollListener (layoutManager); onScrollListener.LoadMoreEvent += (object sender, EventArgs e) => { page++; lastPage=MyVote_Data.getLastPage (); if (page <= lastPage && isRefeshing == false) { ThreadPool.QueueUserWorkItem (o => { setupMyVoteData (page); }); } }; mRecyclerView.AddOnScrollListener (onScrollListener); mRecyclerView.SetLayoutManager (layoutManager); } }
/** * Implement this method to customize the AbsListView */ protected void InitRecyclerView(View view) { mRecycler = (RecyclerView)view.FindViewById(AndroidResource.Id.List); tipView = (TextView)view.FindViewById(Resource.Id.tvTip); SetItemAnimator(null); if (mRecycler == null) { return; } mRecycler.HasFixedSize = true; mRecycler.SetClipToPadding(mClipToPadding); mInternalOnScrollListener = new CustomOnScrollListener(this); mRecycler.AddOnScrollListener(mInternalOnScrollListener); if (mPadding != -1.0f) { mRecycler.SetPadding(mPadding, mPadding, mPadding, mPadding); } else { mRecycler.SetPadding(mPaddingLeft, mPaddingTop, mPaddingRight, mPaddingBottom); } if (mScrollbarStyle != -1) { mRecycler.ScrollBarStyle = (ScrollbarStyles)mScrollbarStyle; } switch (mScrollbar) { case 0: VerticalScrollBarEnabled = false; break; case 1: HorizontalScrollBarEnabled = false; break; case 2: VerticalScrollBarEnabled = false; HorizontalScrollBarEnabled = false; break; } }
public override void OnViewCreated(View view, Bundle savedInstanceState) { if (IsInitialized) { return; } base.OnViewCreated(view, savedInstanceState); var count = Activity.Intent.GetIntExtra(FeedFragment.PostNetVotesExtraPath, 0); _peopleCount.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.PeopleText, count); _backButton.Visibility = ViewStates.Visible; _backButton.Click += GoBackClick; _switcher.Visibility = ViewStates.Gone; _settings.Visibility = ViewStates.Gone; _viewTitle.Typeface = Style.Semibold; _peopleCount.Typeface = Style.Regular; _isLikers = Activity.Intent.GetBooleanExtra(VotersType, true); _viewTitle.Text = AppSettings.LocalizationManager.GetText(_isLikers ? LocalizationKeys.Voters : LocalizationKeys.FlagVoters); _url = Activity.Intent.GetStringExtra(FeedFragment.PostUrlExtraPath); Presenter.SourceChanged += PresenterSourceChanged; Presenter.VotersType = _isLikers ? Core.Models.Enums.VotersType.Likes : Core.Models.Enums.VotersType.Flags; _adapter = new FollowersAdapter(Activity, Presenter); _adapter.UserAction += OnClick; _adapter.FollowAction += OnFollow; _votersList.SetAdapter(_adapter); var scrollListner = new ScrollListener(); scrollListner.ScrolledToBottom += LoadNext; _votersList.AddOnScrollListener(scrollListner); _votersList.SetLayoutManager(new LinearLayoutManager(Activity)); _emptyQueryLabel.Typeface = Style.Light; _emptyQueryLabel.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.EmptyCategory); LoadNext(); }
private void SetRecyclerViewAdapters() { try { CommentsAdapter = new CommentsAdapter(Activity); MLayoutManager = new LinearLayoutManager(Activity); CommentRecyclerView.SetLayoutManager(MLayoutManager); CommentRecyclerView.SetAdapter(CommentsAdapter); RecyclerViewOnScrollListener xamarinRecyclerViewOnScrollListener = new RecyclerViewOnScrollListener(MLayoutManager); MainScrollEvent = xamarinRecyclerViewOnScrollListener; MainScrollEvent.LoadMoreEvent += OnScroll_OnLoadMoreEvent; CommentRecyclerView.AddOnScrollListener(xamarinRecyclerViewOnScrollListener); MainScrollEvent.IsLoading = false; } catch (Exception e) { Console.WriteLine(e); } }
private void SetRecyclerViewAdapters() { try { MAdapter = new SocialAdapter(this, SocialModelType.Pages); LayoutManager = new LinearLayoutManager(this); MRecycler.SetLayoutManager(LayoutManager); MRecycler.SetAdapter(MAdapter); MRecycler.HasFixedSize = true; MRecycler.SetItemViewCacheSize(10); MRecycler.GetLayoutManager().ItemPrefetchEnabled = true; var sizeProvider = new FixedPreloadSizeProvider(10, 10); var preLoader = new RecyclerViewPreloader <SocialModelsClass>(this, MAdapter, sizeProvider, 8); MRecycler.AddOnScrollListener(preLoader); } catch (Exception e) { Console.WriteLine(e); } }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Tournament aaa = new Tournament("Turniej Gfinity 2016 PRO League", "Virtus.pro", "Fnatic", "28.05 20:15", "Counter-Strike: Global Offensive"); view = inflater.Inflate(Resource.Layout.Tournament, container, false); for (int a = 0; a < 15; a++) { Generuj_Event_class(); } mRecyclerView = view.FindViewById <RecyclerView>(Resource.Id.recyclerview); //mRecyclerView = inflater.Inflate(Resource.Layout.Friends, container, false) as RecyclerView; var mLayoutManager = new LinearLayoutManager(((AppCompatActivity)this.Activity)); mAdapter = new RecyclerAdapter(lista_wydarzen); var onScrollListener = new RecyclerViewOnScrollListener(mLayoutManager); mRecyclerView.AddOnScrollListener(onScrollListener); mRecyclerView.SetLayoutManager(mLayoutManager); mRecyclerView.SetAdapter(mAdapter); // £adowanie nastêpnych wydarzeñ po dojechaniu na sam dó³ onScrollListener.LoadMoreEvent += (object sender, EventArgs e) => { for (int a = 0; a < 5; a++) { Generuj_Event_class(); } //mAdapter.NotifyDataSetChanged(); mAdapter = new RecyclerAdapter(lista_wydarzen); mRecyclerView.SetAdapter(mAdapter); }; SupportToolbar toolBar = view.FindViewById <SupportToolbar>(Resource.Id.toolbar); ((AppCompatActivity)this.Activity).SetSupportActionBar(toolBar); ((AppCompatActivity)this.Activity).SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_menu); ((AppCompatActivity)this.Activity).SupportActionBar.SetDisplayHomeAsUpEnabled(true); ((AppCompatActivity)this.Activity).SupportActionBar.Title = GetString(Resource.String.Tournament_Title); return(view); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { view = inflater.Inflate(Resource.Layout.Quickgame, container, false); mRecyclerView = view.FindViewById <RecyclerView>(Resource.Id.recyclerview); //mRecyclerView = inflater.Inflate(Resource.Layout.Friends, container, false) as RecyclerView; var mLayoutManager = new LinearLayoutManager(((AppCompatActivity)this.Activity)); mAdapter = new RecyclerAdapter(list); var onScrollListener = new RecyclerViewOnScrollListener(mLayoutManager); mRecyclerView.AddOnScrollListener(onScrollListener); mRecyclerView.SetLayoutManager(mLayoutManager); mRecyclerView.SetAdapter(mAdapter); SupportToolbar toolBar = view.FindViewById <SupportToolbar>(Resource.Id.toolbar); ((AppCompatActivity)this.Activity).SetSupportActionBar(toolBar); ((AppCompatActivity)this.Activity).SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_menu); ((AppCompatActivity)this.Activity).SupportActionBar.SetDisplayHomeAsUpEnabled(true); ((AppCompatActivity)this.Activity).SupportActionBar.Title = GetString(Resource.String.Quickgame_Title); FloatingActionButton myFab = (FloatingActionButton)view.FindViewById(Resource.Id.fab); myFab.Click += delegate { Context context = view.Context; Intent intent = new Intent(context, typeof(AddQuickgame)); context.StartActivity(intent); }; mRecyclerView.SetItemClickListener((rv, position, view) => { Intent intent = new Intent(((AppCompatActivity)this.Activity), typeof(QuickgameDetail)); ((AppCompatActivity)this.Activity).StartActivity(intent); }); return(view); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.Inflate(Resource.Layout.en_caso_list_fragment, container, false); swipeRefreshLayout = view.FindViewById <SwipeRefreshLayout>(Resource.Id.encaso_list_swipe); swipeRefreshLayout.Refresh += SwipeRefreshLayout_Refresh; recyclerView = view.FindViewById <RecyclerView>(Resource.Id.encaso_list_recyclerview); LinearLayoutManager linearLayoutManager = new LinearLayoutManager(Context); recyclerView.SetLayoutManager(linearLayoutManager); listRecyclerAdapter = new ListRecyclerAdapter(enCasoFiles) { ToExecutePlay = ((MainActivity)Activity) }; recyclerView.SetAdapter(listRecyclerAdapter); recyclerView.AddOnScrollListener(new CustomScrollListener()); recyclerView.HasFixedSize = true; UpdateList(); return(view); }
/// <summary> /// Method use to initialize resources. /// </summary> private void Init() { rvInbox = (RecyclerView)view.FindViewById(Resource.Id.rvCompaign); // improve performance by indicating the list if fixed size. rvInbox.HasFixedSize = true; layoutManager = new LinearLayoutManager(Activity); rvInbox.SetLayoutManager(layoutManager); refresher = view.FindViewById <SwipeRefreshLayout>(Resource.Id.refresher); tvPullRefresh = (TextView)view.FindViewById(Resource.Id.tvRefresh); refresher.Refresh += Refresher_Refresh; InfiniteScrollListener infiniteScrollListener = new InfiniteScrollListener(layoutManager, LoadMore); rvInbox.AddOnScrollListener(infiniteScrollListener); }
private void SetRecyclerViewAdapters() { try { MAdapter = new CommentsAdapter(this); MLayoutManager = new LinearLayoutManager(this); MRecycler.SetLayoutManager(MLayoutManager); MRecycler.NestedScrollingEnabled = false; MRecycler.SetAdapter(MAdapter); RecyclerViewOnScrollListener recyclerViewOnScrollListener = new RecyclerViewOnScrollListener(MLayoutManager); MainScrollEvent = recyclerViewOnScrollListener; MainScrollEvent.LoadMoreEvent += OnScroll_OnLoadMoreEvent; MRecycler.AddOnScrollListener(recyclerViewOnScrollListener); MainScrollEvent.IsLoading = false; } catch (Exception e) { Console.WriteLine(e); } }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { RecyclerView recyclerView = inflater.Inflate(Resource.Layout.Friends, container, false) as RecyclerView; GetRandomSubList(Lists.Friends.NickStrings, 30); // dodanie 30 obiektów do listy view = inflater.Inflate(Resource.Layout.Friends, container, false); var mLayoutManager = new LinearLayoutManager(recyclerView.Context); var onScrollListener = new RecyclerViewOnScrollListener(mLayoutManager); recyclerView.AddOnScrollListener(onScrollListener); recyclerView.SetLayoutManager(mLayoutManager); mAdapter = new SimpleStringRecyclerViewAdapter(recyclerView.Context, list, Activity.Resources); recyclerView.SetAdapter(mAdapter); recyclerView.SetItemClickListener((rv, position, view) => { //var newFragment = new Chat(); //var ft = FragmentManager.BeginTransaction(); //ft.Replace(Resource.Id.flContent, newFragment); //ft.AddToBackStack(null); //ft.Commit(); }); // Dodanie nowych obiektów do listy po dojechaniu na dó³ onScrollListener.LoadMoreEvent += (object sender, EventArgs e) => { GetRandomSubList(Lists.Friends.NickStrings, 5); // generowanie i dodanie noeych obiektów mAdapter.NotifyDataSetChanged(); }; //NIE DZIA£A //var view = LayoutInflater.From(container.Context).Inflate(Resource.Layout.Hub, container, false); //AppBarLayout appBarLayout = view.FindViewById<AppBarLayout>(Resource.Id.appbar); //appBarLayout.SetExpanded(true, true); return(recyclerView); }
public override View OnCreateView(LayoutInflater inflater ,ViewGroup container ,Bundle savedInstanceState) { View v = inflater.Inflate(Resource.Layout.MyHealth_tab_1 ,container ,false); //TextView tvText = v.FindViewById<TextView> (Resource.Id.textView); recyclerView = v.FindViewById <RecyclerView> (Resource.Id.recyclerView); progressDialog = ProgressDialog.Show (Activity, "Sila Tunggu", "Sedang Memuatkan..."); llMHeT1ErrorLayout = (LinearLayout)v.FindViewById (Resource.Id.llMHeT1ErrorLayout); tvMHeT1ErrorStatus = (TextView)v.FindViewById (Resource.Id.tvMHeT1ErrorStatus); tvMHeT1ErrorStatus.Text = "Sedang memeriksa data..."; mSlideRefreshLayout = v.FindViewById<SwipeRefreshLayout> (Resource.Id.swipelayout); mSlideRefreshLayout.SetColorScheme (Android.Resource.Color.HoloBlueBright, Android.Resource.Color.HoloBlueDark, Android.Resource.Color.HoloGreenLight, Android.Resource.Color.HoloRedLight); mSlideRefreshLayout.Refresh += mSlideRefreshLayout_Refresh; if (recyclerView != null) { recyclerView.HasFixedSize = true; var layoutManager = new LinearLayoutManager (Activity); var onScrollListener = new MyHealthRecyclerViewOnScrollListener (layoutManager); onScrollListener.LoadMoreEvent += (object sender, EventArgs e) => { page++; if (page <= lastPage && isRefreshing == false) { ThreadPool.QueueUserWorkItem (o => { setupMyHealthData (page); }); } }; recyclerView.AddOnScrollListener (onScrollListener); recyclerView.SetLayoutManager (layoutManager); } return v; }
public override View OnCreateView(LayoutInflater inflater ,ViewGroup container ,Bundle savedInstanceState) { View v = inflater.Inflate(Resource.Layout.MySoal_tab_1 ,container ,false); //TextView tvText = v.FindViewById<TextView> (Resource.Id.textView); recyclerView = v.FindViewById <RecyclerView> (Resource.Id.recyclerView); llMST1ErrorLayout = (LinearLayout)v.FindViewById (Resource.Id.llMST1ErrorLayout); tvMST1ErrorStatus = (TextView)v.FindViewById (Resource.Id.tvMST1ErrorStatus); footerViewUL = ((LayoutInflater)Activity.GetSystemService (Context.LayoutInflaterService)).Inflate (Resource.Layout.MySoal_ReadMoreLayout, null, false); mSlideRefreshLayout = v.FindViewById<SwipeRefreshLayout> (Resource.Id.swipelayout); mSlideRefreshLayout.SetColorScheme (Android.Resource.Color.HoloBlueBright, Android.Resource.Color.HoloBlueDark, Android.Resource.Color.HoloGreenLight, Android.Resource.Color.HoloRedLight); mSlideRefreshLayout.Refresh += mSlideRefreshLayout_Refresh; if (recyclerView != null) { recyclerView.HasFixedSize = true; var layoutManager = new LinearLayoutManager (Activity); var onScrollListener = new MySoalRecyclerViewOnScrollListener (layoutManager); onScrollListener.LoadMoreEvent += (object sender, EventArgs e) => { Console.Error.WriteLine ("isRefeshing" + isRefreshing); page++; if (page <= lastPage && isRefreshing == false) { Console.Error.WriteLine ("masuk"); ThreadPool.QueueUserWorkItem (o => { InitialProgress (page); }); } }; recyclerView.AddOnScrollListener (onScrollListener); recyclerView.SetLayoutManager (layoutManager); } return v; }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { base.OnCreateView(inflater, container, savedInstanceState); var view = inflater.Inflate(Resource.Layout.fragment_past_trips, null); viewModel = new PastTripsViewModel(); recyclerView = view.FindViewById<RecyclerView>(Resource.Id.recyclerView); refresher = view.FindViewById<SwipeRefreshLayout>(Resource.Id.refresher); refresher.Refresh += (sender, e) => viewModel.LoadPastTripsCommand.Execute(null); adapter = new TripAdapter(Activity, viewModel); adapter.ItemClick += OnItemClick; adapter.ItemLongClick += OnItemLongClick; layoutManager = new LinearLayoutManager(Activity) {Orientation = LinearLayoutManager.Vertical}; recyclerView.SetLayoutManager(layoutManager); recyclerView.SetAdapter(adapter); recyclerView.ClearOnScrollListeners(); recyclerView.AddOnScrollListener(new TripsOnScrollListenerListener(viewModel, layoutManager)); return view; }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Use this to return your custom view for this Fragment var rootView = inflater.Inflate(Resource.Layout.list_fragment, container, false); pbNews = rootView.FindViewById<RelativeLayout>(Resource.Id.pbNews); listViewNews = rootView.FindViewById<RecyclerView>(Resource.Id.list_news); emptyView = rootView.FindViewById<TextView>(Resource.Id.empty_view); PreCachingLayoutManager mLayoutManager = new PreCachingLayoutManager(Application.Context); mLayoutManager.Orientation = LinearLayoutManager.Vertical; mLayoutManager.SetExtraLayoutSpace(GetScreenHeight(Activity)); listViewNews.SetLayoutManager(mLayoutManager); listViewNews.SetLayoutManager(mLayoutManager); listViewNews.AddOnScrollListener(new mOnScrollListener(this)); refresher = rootView.FindViewById<SwipeRefreshLayout>(Resource.Id.refresher); refresher.SetColorSchemeResources(Resource.Color.orange, Resource.Color.green, Resource.Color.blue); refresher.Refresh+= (sender, e) => { pbNews.Visibility = ViewStates.Visible; load(site + "feed", true); page = 1; detecting = true; }; load (site+"feed",false); return rootView; }
public override View OnCreateView(LayoutInflater inflater ,ViewGroup container ,Bundle savedInstanceState) { tokenData = Activity.Intent.GetStringExtra ("Token"); View v = inflater.Inflate(Resource.Layout.MyKomuniti_tab_1 ,container ,false); //TextView tvText = v.FindViewById<TextView> (Resource.Id.textView); recyclerView = v.FindViewById <RecyclerView> (Resource.Id.recyclerView); progressDialog = ProgressDialog.Show (Activity, "Sila Tunggu", "Sedang Memuatkan..."); llMKkT1ErrorStatus = (LinearLayout)v.FindViewById (Resource.Id.llMKkT1ErrorStatus); tvMKkT1ErrorStatus = (TextView)v.FindViewById (Resource.Id.tvMKkT1ErrorStatus); mSlideRefreshLayout = v.FindViewById<SwipeRefreshLayout> (Resource.Id.swipelayout); mSlideRefreshLayout.SetColorScheme (Android.Resource.Color.HoloBlueBright, Android.Resource.Color.HoloBlueDark, Android.Resource.Color.HoloGreenLight, Android.Resource.Color.HoloRedLight); mSlideRefreshLayout.Refresh += mSlideRefreshLayout_Refresh; if (recyclerView != null) { recyclerView.HasFixedSize = true; var layoutManager = new LinearLayoutManager (Activity); var onScrollListener = new MyKomunitiRecyclerViewOnScrollListener (layoutManager); onScrollListener.LoadMoreEvent += (object sender, EventArgs e) => { Console.Error.WriteLine ("isRefeshing" + isRefreshing); page++; if (page <= lastPage && isRefreshing == false) { Console.Error.WriteLine ("masuk"); ThreadPool.QueueUserWorkItem (o => { InitialSetup (tokenData, page); }); } }; recyclerView.AddOnScrollListener (onScrollListener); recyclerView.SetLayoutManager (layoutManager); } return v; }
public override View OnCreateView(LayoutInflater inflater ,ViewGroup container ,Bundle savedInstanceState) { View v = inflater.Inflate(Resource.Layout.MyHealth_tab_2 ,container ,false); recyclerView = v.FindViewById <RecyclerView> (Resource.Id.recyclerViewTakwim); //mListView = v.FindViewById <ListView> (Resource.Id.listViewContainer); //mListView = v.FindViewById <ListView> (Android.Resource.Id.List); llMHeT2ErrorLayout = (LinearLayout)v.FindViewById (Resource.Id.llMHeT2ErrorLayout); tvMHeT2ErrorStatus = (TextView)v.FindViewById (Resource.Id.tvMHeT2ErrorStatus); mSlideRefreshLayout = v.FindViewById<SwipeRefreshLayout> (Resource.Id.swipelayout); mSlideRefreshLayout.SetColorScheme (Android.Resource.Color.HoloBlueBright, Android.Resource.Color.HoloBlueDark, Android.Resource.Color.HoloGreenLight, Android.Resource.Color.HoloRedLight); mSlideRefreshLayout.Refresh += mSlideRefreshLayout_Refresh; if (recyclerView != null) { recyclerView.HasFixedSize = true; var layoutManager = new LinearLayoutManager (Activity); var onScrollListener = new MyHealthBWRecyclerViewOnScrollListener (layoutManager); onScrollListener.LoadMoreEvent += (object sender, EventArgs e) => { Console.Error.WriteLine ("isRefeshing" + isRefreshing); page++; if (page <= lastPage && isRefreshing == false) { Console.Error.WriteLine ("masuk"); ThreadPool.QueueUserWorkItem (o => { setupMyHealthData (page); }); } }; recyclerView.AddOnScrollListener (onScrollListener); recyclerView.SetLayoutManager (layoutManager); } return v; }
//region register scrollables /** * Register a RecyclerView to the current MaterialViewPagerAnimator * Listen to RecyclerView.OnScrollListener so give to $[onScrollListener] your RecyclerView.OnScrollListener if you already use one * For loadmore or anything else * * @param recyclerView the scrollable * @param onScrollListener use it if you want to get a callback of the RecyclerView */ public void RegisterRecyclerView(RecyclerView recyclerView, RecyclerView.OnScrollListener onScrollListener) { if (recyclerView != null) { ScrollViewList.Add(recyclerView); //add to the scrollable list YOffsets.AddOrUpdate(recyclerView, recyclerView.ScrollY); //save the initial recyclerview's yOffset (0) into hashmap //only necessary for recyclerview //listen to scroll recyclerView.AddOnScrollListener(new RecyclerViewScrollListener(this, onScrollListener)); recyclerView.Post(() => SetScrollOffset(recyclerView, LastYOffset)); } }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (Arguments != null) { site = Arguments.GetString("baseUrl", "http://smartreporter.altervista.org/"); } searching = false; loadedSite = "http://smartreporter.altervista.org/"; var rootView = inflater.Inflate(Resource.Layout.list_fragment, container, false); if (savedInstanceState != null) { IParcelable savedRecyclerLayoutState = (IParcelable)savedInstanceState.GetParcelable("recycler_layout"); listViewNews.GetLayoutManager().OnRestoreInstanceState(savedRecyclerLayoutState); } pbNews = rootView.FindViewById<RelativeLayout>(Resource.Id.pbNews); listViewNews = rootView.FindViewById<RecyclerView>(Resource.Id.list_news); emptyView = rootView.FindViewById<TextView>(Resource.Id.empty_view); //Setup layout manager PreCachingLayoutManager mLayoutManager = new PreCachingLayoutManager(Application.Context); mLayoutManager.Orientation = LinearLayoutManager.Vertical; mLayoutManager.SetExtraLayoutSpace(GetScreenHeight(Activity)); listViewNews.SetLayoutManager(mLayoutManager); listViewNews.AddOnScrollListener(new mOnScrollListener(this)); refresher = rootView.FindViewById<SwipeRefreshLayout>(Resource.Id.refresher); refresher.SetColorSchemeResources(Resource.Color.orange, Resource.Color.green, Resource.Color.blue); refresher.Refresh += (sender, e) => { pbNews.Visibility = ViewStates.Visible; load(site + "feed", true); page = 1; detecting = true; }; load(site + "feed", false); return rootView; }