public void InitWithDate(DateTime dateTime) { StopAnimations(); _DateToInitWith = null; UnregisterAutoCorrection(); int doneNum = 0; int targetDone = 2; Func <float, bool> onProgress = p01 => { if (p01 == 1f) { if (++doneNum == targetDone) { _Initialized = true; RegisterAutoCorrection(); } } return(true); }; YearAdapter.ResetItems(3000); YearAdapter.SmoothScrollTo(dateTime.Year - 1, SCROLL_DURATION1, .5f, .5f); MonthAdapter.ResetItems(12); MonthAdapter.SmoothScrollTo(dateTime.Month - 1, SCROLL_DURATION2, .5f, .5f); DayAdapter.ResetItems(DateTime.DaysInMonth(dateTime.Year, dateTime.Month)); DayAdapter.SmoothScrollTo(dateTime.Day - 1, SCROLL_DURATION3, .5f, .5f, onProgress, true); SecondAdapter.ResetItems(60); SecondAdapter.SmoothScrollTo(dateTime.Second, SCROLL_DURATION1, .5f, .5f); MinuteAdapter.ResetItems(60); MinuteAdapter.SmoothScrollTo(dateTime.Minute, SCROLL_DURATION2, .5f, .5f); HourAdapter.ResetItems(24); HourAdapter.SmoothScrollTo(dateTime.Hour, SCROLL_DURATION3, .5f, .5f, onProgress, true); }
public override void OnCreateView(LayoutInflater inflater, ViewGroup container) { base.OnCreateView(inflater, container); #region Desinger Stuff SetContentView(Resource.Layout.FragmentTournaments, inflater, container); //this.HasOptionsMenu = false; #endregion //this.Title = "Campionati"; this.ActionBar.Hide(); _tournamentAdapter = new TournamentAdapter(this, new Tournament[0]); this.TournamentList.SetAdapter(_tournamentAdapter); this.TournamentList.ItemSelected += TournamentList_ItemSelected; //this.TournamentList.ItemLongPress += TaskList_ItemLongPress; //this.TournamentList.ItemCommand += TaskList_ItemCommand; //RecyclerView.ItemDecoration itemDecoration = new SpacesItemDecoration(10); //this.TournamentList.AddItemDecoration(itemDecoration); _yearAdapter = new YearAdapter(this, new Year[0]); this.YearList.SetAdapter(_yearAdapter); this.YearList.ItemSelected += YearList_ItemSelected; LinearLayoutManager layoutManager = new LinearLayoutManager(this.Context, LinearLayoutManager.Horizontal, false); //// Optionally customize the position you want to default scroll to layoutManager.ScrollToPosition(0); // Attach layout manager to the RecyclerView this.YearList.SetLayoutManager(layoutManager); //this.YearList.ItemLongPress += TaskList_ItemLongPress; //this.YearList.ItemCommand += TaskList_ItemCommand; RefreshYears(); }