private void EnsureAdapter () { if (recyclerView.GetAdapter() == null) { var isGrouped = ServiceContainer.Resolve<SettingsStore> ().GroupedTimeEntries; collectionView = isGrouped ? (TimeEntriesCollectionView)new GroupedTimeEntriesView () : new LogTimeEntriesView (); logAdapter = new LogTimeEntriesAdapter (recyclerView, collectionView); recyclerView.SetAdapter (logAdapter); SetupRecyclerView (); } }
private void EnsureAdapter() { if (recyclerView.GetAdapter() == null) { var isGrouped = ServiceContainer.Resolve <SettingsStore> ().GroupedTimeEntries; collectionView = isGrouped ? (TimeEntriesCollectionView) new GroupedTimeEntriesView() : new LogTimeEntriesView(); logAdapter = new LogTimeEntriesAdapter(recyclerView, collectionView); recyclerView.SetAdapter(logAdapter); SetupRecyclerView(); } }
private async Task SyncCollectionView() { IsGroupedMode = ServiceContainer.Resolve <ISettingsStore> ().GroupedTimeEntries; if (collectionView != null) { collectionView.Dispose(); collectionView.CollectionChanged -= OnCollectionChanged; } // In a near future, CollectionView will be only // one object and not divided in two separated classes // like that: LogTimeEntriesView and GroupedTimeEntriesView collectionView = IsGroupedMode ? (TimeEntriesCollectionView) new GroupedTimeEntriesView() : new LogTimeEntriesView(); collectionView.CollectionChanged += OnCollectionChanged; await collectionView.ReloadAsync(); CollectionView = collectionView; }
public LogTimeEntriesAdapter(RecyclerView owner, TimeEntriesCollectionView modelView) : base(owner, modelView) { this.modelView = modelView; lastTimeEntryContinuedTime = Time.UtcNow; }