-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathCustomCellViewProvider.cs
More file actions
40 lines (33 loc) · 1.39 KB
/
Copy pathCustomCellViewProvider.cs
File metadata and controls
40 lines (33 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using System.Collections.Generic;
using Android.Content;
using Android.Views;
using DevExpress.XamarinAndroid.Scheduler.Visual.Data;
using DevExpress.XamarinForms.Scheduler;
using DevExpress.XamarinForms.Scheduler.Android;
namespace CustomMonthViewProviders.Droid {
public class CustomCellViewProvider : ICachedViewProvider {
Queue<View> cache = new Queue<View>();
public void BindView(View view, ItemViewInfo viewInfo, ItemViewModel viewModel) {
CustomCellView cellView = (CustomCellView)view;
cellView.ViewInfo = (MonthCellViewInfo)viewInfo;
cellView.ShowMoreButton = ((MonthViewCellViewModel)viewModel).ShowDownMoreButton;
}
public View CreateNewView(int logicalIndex, ItemViewInfo viewInfo, ItemViewModel viewModel, Context context) {
return new CustomCellView(context);
}
public int GetStubColor(int logicalIndex, ItemViewInfo viewInfo, ItemViewModel viewModel) {
return viewInfo.BackColor;
}
public void Recycle() {
this.cache.Clear();
}
public void RecycleView(View view) {
this.cache.Enqueue(view);
}
public View RequestViewFromCache(int logicalIndex, ItemViewInfo viewInfo, ItemViewModel viewModel) {
if (this.cache.Count == 0)
return null;
return cache.Dequeue();
}
}
}