-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathCustomDayCellViewProvider.cs
More file actions
38 lines (31 loc) · 1.27 KB
/
Copy pathCustomDayCellViewProvider.cs
File metadata and controls
38 lines (31 loc) · 1.27 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
using Android.Views;
using DevExpress.XamarinForms.Scheduler.Android;
using DevExpress.XamarinForms.Scheduler;
using DevExpress.XamarinAndroid.Scheduler.Visual.Data;
using Android.Content;
using System.Collections.Generic;
namespace CustomDayViewProviders.Droid {
public class CustomDayCellViewProvider : ICachedViewProvider {
Queue<View> viewCache = new Queue<View>();
public void BindView(View view, ItemViewInfo viewInfo, ItemViewModel viewModel) {
((CustomCell)view).ViewInfo = (CellViewInfo)viewInfo;
}
public View CreateNewView(int logicalIndex, ItemViewInfo viewInfo, ItemViewModel viewModel, Context context) {
return new CustomCell(context);
}
public int GetStubColor(int logicalIndex, ItemViewInfo viewInfo, ItemViewModel viewModel) {
return viewInfo.BackColor;
}
public void Recycle() {
this.viewCache.Clear();
}
public void RecycleView(View view) {
this.viewCache.Enqueue(view);
}
public View RequestViewFromCache(int logicalIndex, ItemViewInfo viewInfo, ItemViewModel viewModel) {
if (this.viewCache.Count == 0)
return null;
return this.viewCache.Dequeue();
}
}
}