@nstudio/ui-collectionview 5.1.9-alpha.5 → 5.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.android.js CHANGED
@@ -1,6 +1,9 @@
1
+ var _a, _b;
1
2
  /* eslint-disable no-redeclare */
2
- import { ChangeType, ContentView, Property, ProxyViewContainer, Trace, Utils, View, booleanConverter, paddingBottomProperty, paddingLeftProperty, paddingRightProperty, paddingTopProperty, profile } from '@nativescript/core';
3
- import { CLog, CLogTypes, CollectionViewBase, ViewTemplateType, isScrollEnabledProperty, orientationProperty, reorderLongPressEnabledProperty, reorderingEnabledProperty, reverseLayoutProperty, scrollBarIndicatorVisibleProperty } from './common';
3
+ import { ChangeType, ContentView, CoreTypes, Length, Property, ProxyViewContainer, Trace, Utils, View, booleanConverter, paddingBottomProperty, paddingLeftProperty, paddingRightProperty, paddingTopProperty, profile } from '@nativescript/core';
4
+ import { itemOverlapProperty, reorderLongPressEnabledProperty, reorderingEnabledProperty, reverseLayoutProperty, scrollBarIndicatorVisibleProperty } from '.';
5
+ import { CLog, CLogTypes, CollectionViewBase, ListViewViewTypes, isScrollEnabledProperty, orientationProperty } from './common';
6
+ import { createArrayBuffer } from '@nativescript-community/arraybuffers';
4
7
  export * from './common';
5
8
  let CollectionViewCellHolder;
6
9
  let CollectionViewRecyclerView;
@@ -13,13 +16,17 @@ var SimpleCallback = /** @class */ (function (_super) {
13
16
  return global.__native(_this);
14
17
  }
15
18
  SimpleCallback.prototype.onMove = function (recyclerview, viewHolder, target) {
19
+ var _a;
16
20
  var startPosition = viewHolder.getAdapterPosition();
17
21
  var endPosition = target.getAdapterPosition();
22
+ var owner = (_a = this.owner) === null || _a === void 0 ? void 0 : _a.get();
23
+ if (owner && !owner._canReorderToPosition(startPosition, endPosition, owner.getItemAtIndex(endPosition))) {
24
+ return false;
25
+ }
18
26
  if (this.startPosition === -1) {
19
27
  this.startPosition = startPosition;
20
28
  }
21
29
  this.endPosition = endPosition;
22
- var owner = this.owner && this.owner.get();
23
30
  if (owner) {
24
31
  owner._reorderItemInSource(startPosition, endPosition);
25
32
  return true;
@@ -27,6 +34,7 @@ var SimpleCallback = /** @class */ (function (_super) {
27
34
  return false;
28
35
  };
29
36
  SimpleCallback.prototype.onSelectedChanged = function (viewHolder, state) {
37
+ var _a;
30
38
  if (viewHolder) {
31
39
  if (this.startPosition === -1) {
32
40
  this.startPosition = viewHolder.getAdapterPosition();
@@ -34,7 +42,7 @@ var SimpleCallback = /** @class */ (function (_super) {
34
42
  }
35
43
  if (!viewHolder) {
36
44
  // this is where we identify the end of the drag and call the end event
37
- var owner = this.owner && this.owner.get();
45
+ var owner = (_a = this.owner) === null || _a === void 0 ? void 0 : _a.get();
38
46
  if (this.endPosition === -1) {
39
47
  this.endPosition = this.startPosition;
40
48
  }
@@ -66,7 +74,8 @@ var LongPressGestureListenerImpl = /** @class */ (function (_super) {
66
74
  return global.__native(_this);
67
75
  }
68
76
  LongPressGestureListenerImpl.prototype.onLongPress = function (motionEvent) {
69
- var owner = this._owner && this._owner.get();
77
+ var _a;
78
+ var owner = (_a = this._owner) === null || _a === void 0 ? void 0 : _a.get();
70
79
  if (owner) {
71
80
  owner.onReorderLongPress(motionEvent);
72
81
  }
@@ -75,16 +84,21 @@ var LongPressGestureListenerImpl = /** @class */ (function (_super) {
75
84
  }(android.view.GestureDetector.SimpleOnGestureListener));
76
85
  let LayoutParams;
77
86
  const extraLayoutSpaceProperty = new Property({
78
- name: 'extraLayoutSpace'
87
+ name: 'extraLayoutSpace',
79
88
  });
80
89
  const itemViewCacheSizeProperty = new Property({
81
- name: 'itemViewCacheSize'
90
+ name: 'itemViewCacheSize',
82
91
  });
83
92
  const nestedScrollingEnabledProperty = new Property({
84
93
  name: 'nestedScrollingEnabled',
85
94
  defaultValue: true,
86
- valueConverter: booleanConverter
95
+ valueConverter: booleanConverter,
87
96
  });
97
+ export var SnapPosition;
98
+ (function (SnapPosition) {
99
+ SnapPosition[SnapPosition["START"] = 0] = "START";
100
+ SnapPosition[SnapPosition["END"] = 1] = "END";
101
+ })(SnapPosition || (SnapPosition = {}));
88
102
  export class CollectionView extends CollectionViewBase {
89
103
  constructor() {
90
104
  super(...arguments);
@@ -99,10 +113,30 @@ export class CollectionView extends CollectionViewBase {
99
113
  this.scrolling = false;
100
114
  this.needsScrollStartEvent = false;
101
115
  this.animateItemUpdate = false;
116
+ this.mInPropertiesSet = false;
117
+ this.mShouldUpdateInnerSize = false;
118
+ this.mShouldUpdateSpanCount = false;
119
+ this.mShouldRefresh = false;
102
120
  this.defaultPoolSize = 10;
103
121
  this.desiredPoolSize = new Map();
104
122
  this.isDragging = false;
105
123
  this._layedOut = false;
124
+ this.bindedViewHolders = new Set();
125
+ }
126
+ onResumeNativeUpdates() {
127
+ // {N} suspends properties update on `_suspendNativeUpdates`. So we only need to do this in onResumeNativeUpdates
128
+ this.mInPropertiesSet = true;
129
+ super.onResumeNativeUpdates();
130
+ this.mInPropertiesSet = false;
131
+ if (this.mShouldUpdateInnerSize) {
132
+ this.updateInnerSize();
133
+ }
134
+ if (this.mShouldUpdateSpanCount) {
135
+ this.updateSpanCount();
136
+ }
137
+ if (this.mShouldRefresh) {
138
+ this.refresh();
139
+ }
106
140
  }
107
141
  createNativeView() {
108
142
  // storing the class in a property for reuse in the future cause a materializing which is pretty slow!
@@ -122,55 +156,59 @@ export class CollectionView extends CollectionViewBase {
122
156
  return recyclerView;
123
157
  }
124
158
  initNativeView() {
125
- this.setOnLayoutChangeListener();
126
159
  super.initNativeView();
127
160
  const nativeView = this.nativeViewProtected;
128
- this.recycledViewPool = new com.nativescript.collectionview.RecycledViewPool();
129
- this.recycledViewPoolDisposeListener = new com.nativescript.collectionview.RecycledViewPool.ViewPoolListener({
130
- onViewHolderDisposed: (holder) => {
131
- if (Trace.isEnabled()) {
132
- CLog(CLogTypes.log, 'onViewHolderDisposed', holder);
133
- }
134
- if (this._viewHolders) {
135
- this._viewHolders.delete(holder);
136
- }
137
- const isNonSync = holder['defaultItemView'] === true;
138
- const view = isNonSync ? holder.view.content : holder.view;
139
- this.notifyForItemAtIndex(CollectionViewBase.itemDisposingEvent, view, holder.getAdapterPosition(), view.bindingContext, holder);
140
- if (view && view.isLoaded) {
141
- view.callUnloaded();
142
- }
143
- view._isAddedToNativeVisualTree = false;
144
- //@ts-ignore
145
- view.parent = null;
146
- view._tearDownUI();
147
- }
148
- });
149
- this.recycledViewPool.mListener = this.recycledViewPoolDisposeListener;
150
- const recyclerListener = (this.recyclerListener = new androidx.recyclerview.widget.RecyclerView.RecyclerListener({
151
- onViewRecycled: (holder) => {
152
- if (Trace.isEnabled()) {
153
- CLog(CLogTypes.log, 'onViewRecycled', holder);
154
- }
155
- const isNonSync = holder['defaultItemView'] === true;
156
- const view = isNonSync ? holder.view.content : holder.view;
157
- this.notifyForItemAtIndex(CollectionViewBase.itemRecyclingEvent, view, holder.getAdapterPosition(), view.bindingContext, holder);
158
- }
159
- }));
160
- nativeView.setRecyclerListener(recyclerListener);
161
+ if (!this.recycledViewPool) {
162
+ this.recycledViewPool = new com.nativescript.collectionview.RecycledViewPool();
163
+ this.recycledViewPoolDisposeListener = new com.nativescript.collectionview.RecycledViewPool.ViewPoolListener({
164
+ onViewHolderDisposed: (holder) => {
165
+ if (Trace.isEnabled()) {
166
+ CLog(CLogTypes.log, 'onViewHolderDisposed', holder);
167
+ }
168
+ if (this._viewHolders) {
169
+ this._viewHolders.delete(holder);
170
+ }
171
+ const isNonSync = holder['defaultItemView'] === true;
172
+ const view = isNonSync ? holder.view.content : holder.view;
173
+ this.notifyForItemAtIndex(CollectionViewBase.itemDisposingEvent, view, holder.getAdapterPosition(), view.bindingContext, holder);
174
+ if (view && view.isLoaded) {
175
+ view.callUnloaded();
176
+ }
177
+ view._isAddedToNativeVisualTree = false;
178
+ //@ts-ignore
179
+ view.parent = null;
180
+ view._tearDownUI();
181
+ },
182
+ });
183
+ this.recycledViewPool.mListener = this.recycledViewPoolDisposeListener;
184
+ }
185
+ if (Trace.isEnabled() || this.hasListeners(CollectionViewBase.itemRecyclingEvent)) {
186
+ const recyclerListener = (this.recyclerListener = new androidx.recyclerview.widget.RecyclerView.RecyclerListener({
187
+ onViewRecycled: (holder) => {
188
+ if (Trace.isEnabled()) {
189
+ CLog(CLogTypes.log, 'onViewRecycled', this, nativeView, holder);
190
+ }
191
+ const isNonSync = holder['defaultItemView'] === true;
192
+ const view = isNonSync ? holder.view.content : holder.view;
193
+ this.notifyForItemAtIndex(CollectionViewBase.itemRecyclingEvent, view, holder.getAdapterPosition(), view.bindingContext, holder);
194
+ },
195
+ }));
196
+ nativeView.setRecyclerListener(recyclerListener);
197
+ }
161
198
  nativeView.setRecycledViewPool(this.recycledViewPool);
162
- // nativeView.owner = new WeakRef(this);
163
- // nativeView.sizeChangedListener = new com.nativescript.collectionview.SizeChangedListener({
164
- // onSizeChanged: (w, h, oldW, oldH) => this.onSizeChanged(w, h),
165
- // });
166
- // const orientation = this._getLayoutManagarOrientation();
167
- // initGridLayoutManager();
168
199
  let layoutManager;
169
200
  if (CollectionViewBase.layoutStyles[this.layoutStyle]) {
170
201
  layoutManager = CollectionViewBase.layoutStyles[this.layoutStyle].createLayout(this);
171
202
  }
172
203
  else {
173
204
  layoutManager = new com.nativescript.collectionview.PreCachingGridLayoutManager(this._context, 1);
205
+ if (this.hasListeners(CollectionView.layoutCompletedEvent)) {
206
+ layoutManager.layoutCompletedListener = new com.nativescript.collectionview.GridLayoutManager.LayoutCompletedListener({
207
+ onLayoutCompleted: () => {
208
+ this.notify({ eventName: CollectionView.layoutCompletedEvent });
209
+ },
210
+ });
211
+ }
174
212
  // layoutManager = new PreCachingGridLayoutManager(this._context, 1);
175
213
  // (layoutManager as any).owner = new WeakRef(this);
176
214
  }
@@ -178,19 +216,21 @@ export class CollectionView extends CollectionViewBase {
178
216
  nativeView.setLayoutManager(layoutManager);
179
217
  nativeView.layoutManager = layoutManager;
180
218
  nativeView.sizeChangedListener = new com.nativescript.collectionview.SizeChangedListener({
181
- onSizeChanged() { },
182
- onMeasure: () => this.updateInnerSize()
219
+ onLayout: (changed, left, top, right, bottom) => changed && this.onLayout(left, top, right, bottom),
220
+ onMeasure: (widthMeasureSpec, heightMeasureSpec) => this.onMeasure(widthMeasureSpec, heightMeasureSpec),
183
221
  });
184
222
  this.spanSize = this._getSpanSize;
185
- const animator = new com.h6ah4i.android.widget.advrecyclerview.animator.RefactoredDefaultItemAnimator();
223
+ // const animator = new jp.wasabeef.recyclerview.animators.FadeInAnimator();
224
+ // // animator.setInterpolator(new android.view.animation.OvershootInterpolator());
225
+ // animator.setMoveDuration(200);
186
226
  // Change animations are enabled by default since support-v7-recyclerview v22.
187
227
  // Need to disable them when using animation indicator.
188
- animator.setSupportsChangeAnimations(false);
189
- nativeView.setItemAnimator(animator);
190
- this.refresh();
228
+ // animator.setSupportsChangeAnimations(false);
229
+ // nativeView.setItemAnimator(animator);
230
+ // enforce the first refresh for the collectionview to be ready as soon as possible
231
+ this.refresh(true);
191
232
  }
192
233
  disposeNativeView() {
193
- // clear the cache
194
234
  // this.eachChildView((view) => {
195
235
  // view.parent._removeView(view);
196
236
  // return true;
@@ -201,27 +241,24 @@ export class CollectionView extends CollectionViewBase {
201
241
  nativeView.setRecycledViewPool(null);
202
242
  this.recycledViewPoolDisposeListener = null;
203
243
  this.recycledViewPool = null;
204
- if (nativeView.scrollListener) {
205
- this.nativeView.removeOnScrollListener(nativeView.scrollListener);
206
- nativeView.scrollListener = null;
207
- this._nScrollListener = null;
208
- }
244
+ this.detachScrollListenerIfNecessary(true);
209
245
  nativeView.sizeChangedListener = null;
210
246
  nativeView.layoutManager = null;
211
247
  this._listViewAdapter = null;
212
248
  this._itemTouchHelper = null;
213
249
  this._simpleItemTouchCallback = null;
214
250
  this.disposeViewHolderViews();
215
- this._hlayoutParams = null;
216
- this._vlayoutParams = null;
217
251
  this.clearTemplateTypes();
218
252
  super.disposeNativeView();
219
253
  }
220
254
  onLoaded() {
221
255
  super.onLoaded();
222
- this.attachScrollListener();
223
- this.refresh();
256
+ this.attachScrollListenerIfNecessary();
224
257
  }
258
+ // onUnloaded() {
259
+ // super.onUnloaded();
260
+ // this.detachScrollListenerIfNecessary();
261
+ // }
225
262
  getViewForItemAtIndex(index) {
226
263
  return this.enumerateViewHolders((v) => (v.getAdapterPosition() === index ? v.view : undefined));
227
264
  }
@@ -238,7 +275,7 @@ export class CollectionView extends CollectionViewBase {
238
275
  getSpanSize: (position) => {
239
276
  const dataItem = this.getItemAtIndex(position);
240
277
  return Math.min(inter(dataItem, position), this.currentSpanCount);
241
- }
278
+ },
242
279
  })));
243
280
  }
244
281
  else {
@@ -249,28 +286,56 @@ export class CollectionView extends CollectionViewBase {
249
286
  get spanSize() {
250
287
  return this._getSpanSize;
251
288
  }
252
- attachScrollListener() {
253
- if (this._scrollOrLoadMoreChangeCount > 0 && this.isLoaded) {
254
- const nativeView = this.nativeViewProtected;
255
- if (!nativeView.scrollListener) {
256
- this._nScrollListener = new com.nativescript.collectionview.OnScrollListener.Listener({
257
- onScrollStateChanged: this.onScrollStateChanged.bind(this),
258
- onScrolled: this.onScrolled.bind(this)
289
+ nativeGetItemOverlap(position) {
290
+ const item = this.getItemAtIndex(position);
291
+ const result = this.itemOverlap(item, position);
292
+ this.decoratorBuffer[0] = Length.toDevicePixels(result[0], 0);
293
+ this.decoratorBuffer[1] = Length.toDevicePixels(result[1], 0);
294
+ this.decoratorBuffer[2] = Length.toDevicePixels(result[2], 0);
295
+ this.decoratorBuffer[3] = Length.toDevicePixels(result[3], 0);
296
+ return this.decoratorBuffer;
297
+ }
298
+ [itemOverlapProperty.setNative](value) {
299
+ if (typeof value === 'function') {
300
+ if (!this.decorator) {
301
+ this.decoratorListener = new com.nativescript.collectionview.OverlapDecoration.OverlapDecorationListener({
302
+ getItemOverlap: this.nativeGetItemOverlap.bind(this),
259
303
  });
260
- const scrollListener = new com.nativescript.collectionview.OnScrollListener(this._nScrollListener);
261
- nativeView.addOnScrollListener(scrollListener);
262
- nativeView.scrollListener = scrollListener;
304
+ this.decorator = new com.nativescript.collectionview.OverlapDecoration(this.decoratorListener);
305
+ this.nativeViewProtected.addItemDecoration(this.decorator);
306
+ }
307
+ if (!this.decoratorBuffer) {
308
+ this.decoratorBuffer = createArrayBuffer(4, false, true);
263
309
  }
264
310
  }
311
+ else {
312
+ if (this.decorator) {
313
+ this.nativeViewProtected.removeItemDecoration(this.decorator);
314
+ this.decorator = null;
315
+ }
316
+ this.decoratorListener = null;
317
+ }
265
318
  }
266
- detachScrollListener() {
267
- if (this._scrollOrLoadMoreChangeCount === 0 && this.isLoaded) {
268
- const nativeView = this.nativeViewProtected;
319
+ attachScrollListenerIfNecessary() {
320
+ const nativeView = this.nativeViewProtected;
321
+ if (this._scrollOrLoadMoreChangeCount > 0 && nativeView && !nativeView.scrollListener) {
322
+ this._nScrollListener = new com.nativescript.collectionview.OnScrollListener.Listener({
323
+ onScrollStateChanged: this.onScrollStateChanged.bind(this),
324
+ onScrolled: this.onScrolled.bind(this),
325
+ });
326
+ const scrollListener = new com.nativescript.collectionview.OnScrollListener(this._nScrollListener);
327
+ nativeView.addOnScrollListener(scrollListener);
328
+ nativeView.scrollListener = scrollListener;
329
+ }
330
+ }
331
+ detachScrollListenerIfNecessary(force = false) {
332
+ const nativeView = this.nativeViewProtected;
333
+ if (force || (this._scrollOrLoadMoreChangeCount === 0 && nativeView)) {
269
334
  if (nativeView.scrollListener) {
270
335
  this.nativeView.removeOnScrollListener(nativeView.scrollListener);
271
336
  nativeView.scrollListener = null;
272
- this._nScrollListener = null;
273
337
  }
338
+ this._nScrollListener = null;
274
339
  }
275
340
  }
276
341
  computeScrollEventData(view, eventName, dx, dy) {
@@ -282,9 +347,10 @@ export class CollectionView extends CollectionViewBase {
282
347
  object: this,
283
348
  eventName,
284
349
  scrollOffset: offset / Utils.layout.getDisplayDensity(),
350
+ scrollSize: (range - extent) / Utils.layout.getDisplayDensity(),
285
351
  scrollOffsetPercentage: offset / (range - extent),
286
352
  dx,
287
- dy
353
+ dy,
288
354
  };
289
355
  }
290
356
  onScrolled(view, dx, dy) {
@@ -306,7 +372,6 @@ export class CollectionView extends CollectionViewBase {
306
372
  const lastVisibleItemPos = layoutManager['findLastCompletelyVisibleItemPosition']();
307
373
  const loadMoreItemIndex = this.items.length - this.loadMoreThreshold;
308
374
  if (lastVisibleItemPos === loadMoreItemIndex) {
309
- this.loadingMore = true;
310
375
  this.notify({ eventName: CollectionViewBase.loadMoreItemsEvent });
311
376
  }
312
377
  }
@@ -321,7 +386,6 @@ export class CollectionView extends CollectionViewBase {
321
386
  }
322
387
  const loadMoreItemIndex = this.items.length - this.loadMoreThreshold;
323
388
  if (lastVisibleItemPos >= loadMoreItemIndex) {
324
- this.loadingMore = true;
325
389
  this.notify({ eventName: CollectionViewBase.loadMoreItemsEvent });
326
390
  }
327
391
  }
@@ -345,14 +409,14 @@ export class CollectionView extends CollectionViewBase {
345
409
  super.addEventListener(arg, callback, thisArg);
346
410
  if (arg === CollectionViewBase.scrollEvent || arg === CollectionViewBase.scrollStartEvent || arg === CollectionViewBase.scrollEndEvent || arg === CollectionViewBase.loadMoreItemsEvent) {
347
411
  this._scrollOrLoadMoreChangeCount++;
348
- this.attachScrollListener();
412
+ this.attachScrollListenerIfNecessary();
349
413
  }
350
414
  }
351
415
  removeEventListener(arg, callback, thisArg) {
352
416
  super.removeEventListener(arg, callback, thisArg);
353
417
  if (arg === CollectionViewBase.scrollEvent || arg === CollectionViewBase.scrollStartEvent || arg === CollectionViewBase.scrollEndEvent || arg === CollectionViewBase.loadMoreItemsEvent) {
354
418
  this._scrollOrLoadMoreChangeCount--;
355
- this.detachScrollListener();
419
+ this.detachScrollListenerIfNecessary();
356
420
  }
357
421
  }
358
422
  //@ts-ignore
@@ -487,6 +551,9 @@ export class CollectionView extends CollectionViewBase {
487
551
  enumerateViewHolders(cb) {
488
552
  let result, v;
489
553
  for (let it = this._viewHolders.values(), cellItemView = null; (cellItemView = it.next().value);) {
554
+ if (cellItemView['position'] === undefined) {
555
+ continue;
556
+ }
490
557
  result = cb(cellItemView);
491
558
  if (result) {
492
559
  return result;
@@ -494,6 +561,19 @@ export class CollectionView extends CollectionViewBase {
494
561
  }
495
562
  return result;
496
563
  }
564
+ async enumerateViewHoldersAsync(cb) {
565
+ let result, v;
566
+ for (let it = this._viewHolders.values(), cellItemView = null; (cellItemView = it.next().value);) {
567
+ if (cellItemView['position'] === undefined) {
568
+ continue;
569
+ }
570
+ result = await cb(cellItemView);
571
+ if (result) {
572
+ return result;
573
+ }
574
+ }
575
+ return result;
576
+ }
497
577
  startDragging(index) {
498
578
  if (this.reorderEnabled && this._itemTouchHelper) {
499
579
  // let viewHolder: CollectionViewCellHolder;
@@ -530,7 +610,7 @@ export class CollectionView extends CollectionViewBase {
530
610
  // we will call events only at then end
531
611
  super._reorderItemInSource(oldPosition, newPosition, false);
532
612
  }
533
- [reorderLongPressEnabledProperty.setNative](value) {
613
+ [_a = reorderLongPressEnabledProperty.setNative](value) {
534
614
  if (value) {
535
615
  if (!this._longPressGesture) {
536
616
  this._longPressGesture = new androidx.core.view.GestureDetectorCompat(this._context, new LongPressGestureListenerImpl(new WeakRef(this)));
@@ -542,7 +622,7 @@ export class CollectionView extends CollectionViewBase {
542
622
  return false;
543
623
  },
544
624
  onTouchEvent: (param0, param1) => { },
545
- onRequestDisallowInterceptTouchEvent: (disallowIntercept) => { }
625
+ onRequestDisallowInterceptTouchEvent: (disallowIntercept) => { },
546
626
  });
547
627
  }
548
628
  this.nativeViewProtected.addOnItemTouchListener(this._itemTouchListerner);
@@ -553,7 +633,7 @@ export class CollectionView extends CollectionViewBase {
553
633
  }
554
634
  }
555
635
  }
556
- [reorderingEnabledProperty.setNative](value) {
636
+ [_b = reorderingEnabledProperty.setNative](value) {
557
637
  if (value) {
558
638
  if (!this._simpleItemTouchCallback) {
559
639
  const ItemTouchHelper = androidx.recyclerview.widget.ItemTouchHelper;
@@ -582,50 +662,55 @@ export class CollectionView extends CollectionViewBase {
582
662
  super.onItemTemplatesChanged(oldValue, newValue); // TODO: update current template with the new one
583
663
  this.refresh();
584
664
  }
585
- setOnLayoutChangeListener() {
586
- if (this.nativeViewProtected) {
587
- const owner = this;
588
- this.layoutChangeListenerIsSet = true;
589
- this.layoutChangeListener =
590
- this.layoutChangeListener ||
591
- new android.view.View.OnLayoutChangeListener({
592
- onLayoutChange(v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) {
593
- if (left !== oldLeft || top !== oldTop || right !== oldRight || bottom !== oldBottom) {
594
- owner.onLayout(left, top, right, bottom);
595
- if (owner.hasListeners(View.layoutChangedEvent)) {
596
- owner._raiseLayoutChangedEvent();
597
- }
598
- }
599
- }
600
- });
601
- this.nativeViewProtected.addOnLayoutChangeListener(this.layoutChangeListener);
665
+ updateSpanCount(requestLayout = true) {
666
+ if (this.mInPropertiesSet) {
667
+ this.mShouldUpdateSpanCount = true;
668
+ return false;
602
669
  }
603
- }
604
- _updateSpanCount() {
670
+ this.mShouldUpdateSpanCount = false;
605
671
  const layoutManager = this.layoutManager;
606
672
  if (layoutManager && layoutManager['setSpanCount']) {
607
673
  const newValue = (this.currentSpanCount = this.computeSpanCount());
608
674
  if (newValue !== layoutManager['getSpanCount']()) {
609
675
  layoutManager['setSpanCount'](newValue);
610
- layoutManager.requestLayout();
676
+ if (requestLayout) {
677
+ layoutManager.requestLayout();
678
+ }
679
+ return true;
611
680
  }
612
681
  }
682
+ return false;
613
683
  }
614
684
  updateInnerSize() {
615
- super.updateInnerSize();
616
- this._updateSpanCount();
685
+ if (this.mInPropertiesSet) {
686
+ this.mShouldUpdateInnerSize = true;
687
+ return false;
688
+ }
689
+ this.mShouldUpdateInnerSize = false;
690
+ const result = super.updateInnerSize();
691
+ if (result) {
692
+ this.updateSpanCount();
693
+ }
694
+ // there is no need to call refresh if it was triggered before with same size.
695
+ // this refresh is just to handle size change
696
+ const layoutKey = this._innerWidth + '_' + this._innerHeight;
697
+ if (this._isDataDirty || (this._lastLayoutKey && this._lastLayoutKey !== layoutKey)) {
698
+ // setTimeout(() => this.refresh(false), 0);
699
+ }
700
+ this._lastLayoutKey = layoutKey;
701
+ return result;
617
702
  }
618
703
  _onColWidthPropertyChanged(oldValue, newValue) {
619
- this._updateSpanCount();
704
+ this.updateSpanCount();
620
705
  super._onColWidthPropertyChanged(oldValue, newValue);
621
706
  }
622
707
  _onRowHeightPropertyChanged(oldValue, newValue) {
623
- this._updateSpanCount();
708
+ this.updateSpanCount();
624
709
  super._onRowHeightPropertyChanged(oldValue, newValue);
625
710
  }
626
711
  onLayout(left, top, right, bottom) {
627
712
  this._layedOut = true;
628
- super.onLayout(left, top, right, bottom);
713
+ // super.onLayout(left, top, right, bottom);
629
714
  const p = CollectionViewBase.plugins[this.layoutStyle];
630
715
  if (p && p.onLayout) {
631
716
  p.onLayout(this, left, top, right, bottom);
@@ -634,13 +719,30 @@ export class CollectionView extends CollectionViewBase {
634
719
  const p = CollectionViewBase.plugins[k];
635
720
  p.onLayout && p.onLayout(this, left, top, right, bottom);
636
721
  });
637
- // there is no need to call refresh if it was triggered before with same size.
638
- // this refresh is just to handle size change
639
- const layoutKey = this._innerWidth + '_' + this._innerHeight;
640
- if (this._isDataDirty || (this._lastLayoutKey && this._lastLayoutKey !== layoutKey)) {
641
- setTimeout(() => this.refresh(), 0);
722
+ }
723
+ onMeasure(widthMeasureSpec, heightMeasureSpec) {
724
+ const lastLayoutKey = this._lastLayoutKey;
725
+ this.updateInnerSize();
726
+ if (lastLayoutKey !== this._lastLayoutKey) {
727
+ //we need to refresh visible cells so that they measure to the new size
728
+ // for some reason it gets animated even with setSupportsChangeAnimations(false)
729
+ // so we clear until it is done
730
+ const nativeView = this.nativeViewProtected;
731
+ const animator = nativeView.getItemAnimator();
732
+ nativeView.setItemAnimator(null);
733
+ this.refreshVisibleItems();
734
+ setTimeout(() => {
735
+ nativeView.setItemAnimator(animator);
736
+ }, 0);
642
737
  }
643
- this._lastLayoutKey = layoutKey;
738
+ const p = CollectionViewBase.plugins[this.layoutStyle];
739
+ if (p && p.onMeasure) {
740
+ p.onMeasure(this, widthMeasureSpec, heightMeasureSpec);
741
+ }
742
+ this.plugins.forEach((k) => {
743
+ const p = CollectionViewBase.plugins[k];
744
+ p.onMeasure && p.onMeasure(this, widthMeasureSpec, heightMeasureSpec);
745
+ });
644
746
  }
645
747
  onSourceCollectionChanged(event) {
646
748
  if (!this._listViewAdapter || this._dataUpdatesSuspended) {
@@ -708,7 +810,6 @@ export class CollectionView extends CollectionViewBase {
708
810
  }
709
811
  }
710
812
  this._listViewAdapter.notifyDataSetChanged();
711
- this.loadingMore = false;
712
813
  }
713
814
  eachChild(callback) {
714
815
  // used for css updates (like theme change)
@@ -727,15 +828,28 @@ export class CollectionView extends CollectionViewBase {
727
828
  }
728
829
  });
729
830
  }
831
+ async eachChildAsync(callback) {
832
+ return this.enumerateViewHoldersAsync(async (v) => {
833
+ const view = v.view;
834
+ if (view) {
835
+ if (view.parent instanceof CollectionView) {
836
+ await callback(view);
837
+ }
838
+ else {
839
+ // in some cases (like item is unloaded from another place (like angular) view.parent becomes undefined)
840
+ if (view.parent) {
841
+ await callback(view.parent);
842
+ }
843
+ }
844
+ }
845
+ });
846
+ }
730
847
  refreshVisibleItems() {
731
848
  const view = this.nativeViewProtected;
732
849
  if (!view) {
733
850
  return;
734
851
  }
735
- const ids = Array.from(this._viewHolders)
736
- .map((s) => s['position'])
737
- .filter((s) => s !== null)
738
- .sort((a, b) => a - b);
852
+ const ids = Array.from(this.bindedViewHolders).sort((a, b) => a - b);
739
853
  this._listViewAdapter.notifyItemRangeChanged(ids[0], ids[ids.length - 1] - ids[0] + 1);
740
854
  }
741
855
  isItemAtIndexVisible(index) {
@@ -751,12 +865,41 @@ export class CollectionView extends CollectionViewBase {
751
865
  }
752
866
  return false;
753
867
  }
754
- refresh() {
755
- if (!this.nativeViewProtected) {
868
+ findFirstVisibleItemIndex() {
869
+ const view = this.nativeViewProtected;
870
+ if (!view) {
871
+ return -1;
872
+ }
873
+ const layoutManager = this.layoutManager;
874
+ if (layoutManager['findFirstVisibleItemPosition']) {
875
+ return layoutManager.findFirstVisibleItemPosition();
876
+ }
877
+ return -1;
878
+ }
879
+ findLastVisibleItemIndex() {
880
+ const view = this.nativeViewProtected;
881
+ if (!view) {
882
+ return -1;
883
+ }
884
+ const layoutManager = this.layoutManager;
885
+ if (layoutManager['findLastVisibleItemPosition']) {
886
+ return layoutManager.findLastVisibleItemPosition();
887
+ }
888
+ return -1;
889
+ }
890
+ refresh(forceRefresh = false, updateSpanCountRequestsLayout = false) {
891
+ if (this.mInPropertiesSet) {
892
+ this.mShouldRefresh = true;
756
893
  return;
757
894
  }
895
+ this.mShouldRefresh = false;
758
896
  const view = this.nativeViewProtected;
759
- if (!this.isLoaded) {
897
+ if (!view) {
898
+ return;
899
+ }
900
+ // seems like we refresh sooner
901
+ // not sure why it was needed before and not now.
902
+ if (!forceRefresh && (!this.isLoaded || !this.nativeView)) {
760
903
  this._isDataDirty = true;
761
904
  return;
762
905
  }
@@ -764,14 +907,14 @@ export class CollectionView extends CollectionViewBase {
764
907
  this._lastLayoutKey = this._innerWidth + '_' + this._innerHeight;
765
908
  let adapter = this._listViewAdapter;
766
909
  if (!adapter) {
767
- adapter = this._listViewAdapter = this.createComposedAdapter(this.nativeViewProtected);
910
+ adapter = this._listViewAdapter = this.createComposedAdapter(view);
768
911
  adapter.setHasStableIds(!!this._itemIdGenerator);
769
912
  view.setAdapter(adapter);
770
913
  }
771
914
  else if (!view.getAdapter()) {
772
915
  view.setAdapter(adapter);
773
916
  }
774
- this._updateSpanCount();
917
+ this.updateSpanCount(updateSpanCountRequestsLayout);
775
918
  adapter.notifyDataSetChanged();
776
919
  this.notify({ eventName: CollectionViewBase.dataPopulatedEvent });
777
920
  }
@@ -797,23 +940,27 @@ export class CollectionView extends CollectionViewBase {
797
940
  }
798
941
  return view.computeVerticalScrollOffset() / Utils.layout.getDisplayDensity();
799
942
  }
800
- scrollToIndex(index, animated = true) {
801
- if (!this.nativeViewProtected) {
943
+ scrollToIndex(index, animated = true, snap = SnapPosition.START) {
944
+ const view = this.nativeViewProtected;
945
+ if (!view) {
802
946
  return;
803
947
  }
804
948
  if (animated) {
805
- this.nativeViewProtected.smoothScrollToPosition(index);
949
+ view.smoothScrollToPosition(index, snap);
806
950
  }
807
951
  else {
808
- this.nativeViewProtected.scrollToPosition(index);
952
+ view.scrollToPosition(index);
809
953
  }
810
954
  }
811
955
  scrollToOffset(offSetValue) {
812
- if (this.nativeViewProtected && this.orientation === 'horizontal' && this.isScrollEnabled) {
813
- this.nativeViewProtected.scrollBy(offSetValue, 0);
814
- }
815
- if (this.nativeViewProtected && this.orientation === 'vertical' && this.isScrollEnabled) {
816
- this.nativeViewProtected.scrollBy(0, offSetValue);
956
+ const view = this.nativeViewProtected;
957
+ if (view && this.isScrollEnabled) {
958
+ if (this.orientation === 'horizontal') {
959
+ view.scrollBy(offSetValue, 0);
960
+ }
961
+ else {
962
+ view.scrollBy(0, offSetValue);
963
+ }
817
964
  }
818
965
  }
819
966
  _setPadding(newPadding) {
@@ -822,7 +969,7 @@ export class CollectionView extends CollectionViewBase {
822
969
  top: nativeView.getPaddingTop(),
823
970
  right: nativeView.getPaddingRight(),
824
971
  bottom: nativeView.getPaddingBottom(),
825
- left: nativeView.getPaddingLeft()
972
+ left: nativeView.getPaddingLeft(),
826
973
  };
827
974
  // tslint:disable-next-line:prefer-object-spread
828
975
  const newValue = Object.assign(padding, newPadding);
@@ -838,7 +985,7 @@ export class CollectionView extends CollectionViewBase {
838
985
  getItemCount: this.getItemCount.bind(this),
839
986
  onCreateViewHolder: this.onCreateViewHolder.bind(this),
840
987
  onBindViewHolder: this.onBindViewHolder.bind(this),
841
- onViewRecycled: this.onViewRecycled.bind(this)
988
+ onViewRecycled: this.onViewRecycled.bind(this),
842
989
  });
843
990
  // const composedAdapter = new com.h6ah4i.android.widget.advrecyclerview.composedadapter.ComposedAdapter();
844
991
  // composedAdapter.addAdapter(new CollectionViewAdapter(new WeakRef(this)));
@@ -914,23 +1061,26 @@ export class CollectionView extends CollectionViewBase {
914
1061
  }
915
1062
  return this.templateTypeNumberString.get(key);
916
1063
  }
917
- nativeItemToTemplateKey(item) {
918
- let result;
919
- this.templateTypeNumberString?.forEach((value, key, map) => {
920
- if (value === item) {
921
- result = key;
922
- }
923
- }, this);
924
- return result;
925
- }
1064
+ // public nativeItemToTemplateKey(item: number): string {
1065
+ // let result: string;
1066
+ // this.templateTypeNumberString?.forEach((value, key, map) => {
1067
+ // if (value === item) {
1068
+ // result = key;
1069
+ // }
1070
+ // }, this);
1071
+ // return result;
1072
+ // }
926
1073
  disposeViewHolderViews() {
927
1074
  this.enumerateViewHolders((v) => {
928
1075
  const view = v.view;
929
- if (view && view.isLoaded) {
930
- view.callUnloaded();
1076
+ if (view) {
1077
+ this.notifyForItemAtIndex(CollectionViewBase.itemDisposingEvent, view, v.getAdapterPosition(), view.bindingContext, v);
1078
+ if (view.isLoaded) {
1079
+ view.callUnloaded();
1080
+ }
1081
+ view._isAddedToNativeVisualTree = false;
1082
+ view._tearDownUI();
931
1083
  }
932
- view._isAddedToNativeVisualTree = false;
933
- view._tearDownUI();
934
1084
  v.view = null;
935
1085
  v.clickListener = null;
936
1086
  });
@@ -940,7 +1090,8 @@ export class CollectionView extends CollectionViewBase {
940
1090
  return this.templateStringTypeNumber.get(viewType);
941
1091
  }
942
1092
  onCreateViewHolder(parent, viewType) {
943
- let view = this.getViewForTemplateType(this.getKeyByValue(viewType), ViewTemplateType.Item);
1093
+ const start = Date.now();
1094
+ let view = this.getViewForViewType(ListViewViewTypes.ItemView, this.getKeyByValue(viewType));
944
1095
  const isNonSync = view === undefined;
945
1096
  // dont create unecessary StackLayout if template.createView returns. Will happend when not using Vue or angular
946
1097
  if (isNonSync || view instanceof ProxyViewContainer) {
@@ -948,10 +1099,10 @@ export class CollectionView extends CollectionViewBase {
948
1099
  parentView.id = 'collectionViewHolder';
949
1100
  view = parentView;
950
1101
  }
951
- view._setupAsRootView(this._context);
952
- view._isAddedToNativeVisualTree = true;
953
1102
  //@ts-ignore
954
1103
  view.parent = this;
1104
+ view._setupAsRootView(this._context);
1105
+ view._isAddedToNativeVisualTree = true;
955
1106
  view.callLoaded();
956
1107
  if (!CollectionViewCellHolder) {
957
1108
  CollectionViewCellHolder = com.nativescript.collectionview.CollectionViewCellHolder;
@@ -966,9 +1117,9 @@ export class CollectionView extends CollectionViewBase {
966
1117
  object: collectionView,
967
1118
  index: position,
968
1119
  item: collectionView.getItem(position),
969
- view: holder.view
1120
+ view: holder.view,
970
1121
  });
971
- }
1122
+ },
972
1123
  });
973
1124
  view.nativeView.setOnClickListener(clickListener);
974
1125
  holder.clickListener = clickListener;
@@ -980,7 +1131,7 @@ export class CollectionView extends CollectionViewBase {
980
1131
  }
981
1132
  this._viewHolders.add(holder);
982
1133
  if (Trace.isEnabled()) {
983
- CLog(CLogTypes.log, 'onCreateViewHolder', viewType, this.getKeyByValue(viewType));
1134
+ CLog(CLogTypes.log, 'onCreateViewHolder', this, this.nativeView, viewType, this.getKeyByValue(viewType), holder, Date.now() - start, 'ms');
984
1135
  }
985
1136
  return holder;
986
1137
  }
@@ -990,14 +1141,19 @@ export class CollectionView extends CollectionViewBase {
990
1141
  return args;
991
1142
  }
992
1143
  onBindViewHolder(holder, position) {
1144
+ const start = Date.now();
993
1145
  if (Trace.isEnabled()) {
994
- CLog(CLogTypes.log, 'onBindViewHolder', position);
1146
+ CLog(CLogTypes.log, 'onBindViewHolder', this, this.nativeView, position, holder, holder.view);
995
1147
  }
996
1148
  let view = holder.view;
997
1149
  const isNonSync = holder['defaultItemView'] === true;
998
1150
  view = isNonSync ? view.content : view;
999
1151
  const bindingContext = this._prepareItem(view, position);
1152
+ if (holder['position'] !== undefined) {
1153
+ this.bindedViewHolders.delete(holder['position']);
1154
+ }
1000
1155
  holder['position'] = position;
1156
+ this.bindedViewHolders.add(holder['position']);
1001
1157
  const args = this.notifyForItemAtIndex(CollectionViewBase.itemLoadingEvent, view, position, bindingContext, holder);
1002
1158
  if (isNonSync && args.view !== view) {
1003
1159
  view = args.view;
@@ -1024,21 +1180,23 @@ export class CollectionView extends CollectionViewBase {
1024
1180
  if (height || !view.height) {
1025
1181
  view.height = Utils.layout.toDeviceIndependentPixels(height);
1026
1182
  }
1027
- // if (this.hasListeners(CollectionViewBase.displayItemEvent) ) {
1028
- // this.notify<CollectionViewItemDisplayEventData>({
1029
- // eventName: CollectionViewBase.displayItemEvent,
1030
- // index:position,
1031
- // object: this,
1032
- // });
1033
- // }
1183
+ if (this.hasListeners(CollectionViewBase.displayItemEvent)) {
1184
+ this.notify({
1185
+ eventName: CollectionViewBase.displayItemEvent,
1186
+ index: position,
1187
+ object: this,
1188
+ });
1189
+ }
1034
1190
  if (Trace.isEnabled()) {
1035
- CLog(CLogTypes.log, 'onBindViewHolder done ', position);
1191
+ CLog(CLogTypes.log, 'onBindViewHolder done ', position, Date.now() - start, 'ms');
1036
1192
  }
1037
1193
  }
1038
1194
  onViewRecycled(holder) {
1039
- holder['position'] = null;
1195
+ delete this.bindedViewHolders[holder['position']];
1196
+ holder['position'] = undefined;
1040
1197
  }
1041
1198
  }
1199
+ CollectionView.layoutCompletedEvent = 'layoutCompleted';
1042
1200
  CollectionView.DEFAULT_TEMPLATE_VIEW_TYPE = 0;
1043
1201
  CollectionView.CUSTOM_TEMPLATE_ITEM_TYPE = 1;
1044
1202
  __decorate([
@@ -1058,13 +1216,145 @@ __decorate([
1058
1216
  __metadata("design:type", Function),
1059
1217
  __metadata("design:paramtypes", []),
1060
1218
  __metadata("design:returntype", void 0)
1219
+ ], CollectionView.prototype, "disposeNativeView", null);
1220
+ __decorate([
1221
+ profile,
1222
+ __metadata("design:type", Function),
1223
+ __metadata("design:paramtypes", [String, Number]),
1224
+ __metadata("design:returntype", void 0)
1225
+ ], CollectionView.prototype, "setNativePoolSize", null);
1226
+ __decorate([
1227
+ profile,
1228
+ __metadata("design:type", Function),
1229
+ __metadata("design:paramtypes", []),
1230
+ __metadata("design:returntype", void 0)
1231
+ ], CollectionView.prototype, "setPoolSizes", null);
1232
+ __decorate([
1233
+ profile,
1234
+ __metadata("design:type", Function),
1235
+ __metadata("design:paramtypes", [Boolean]),
1236
+ __metadata("design:returntype", void 0)
1237
+ ], CollectionView.prototype, _a, null);
1238
+ __decorate([
1239
+ profile,
1240
+ __metadata("design:type", Function),
1241
+ __metadata("design:paramtypes", [Boolean]),
1242
+ __metadata("design:returntype", void 0)
1243
+ ], CollectionView.prototype, _b, null);
1244
+ __decorate([
1245
+ profile,
1246
+ __metadata("design:type", Function),
1247
+ __metadata("design:paramtypes", []),
1248
+ __metadata("design:returntype", void 0)
1249
+ ], CollectionView.prototype, "onItemViewLoaderChanged", null);
1250
+ __decorate([
1251
+ profile,
1252
+ __metadata("design:type", Function),
1253
+ __metadata("design:paramtypes", [Object, Object]),
1254
+ __metadata("design:returntype", void 0)
1255
+ ], CollectionView.prototype, "onItemTemplateSelectorChanged", null);
1256
+ __decorate([
1257
+ profile,
1258
+ __metadata("design:type", Function),
1259
+ __metadata("design:paramtypes", [Object, Object]),
1260
+ __metadata("design:returntype", void 0)
1261
+ ], CollectionView.prototype, "onItemTemplateChanged", null);
1262
+ __decorate([
1263
+ profile,
1264
+ __metadata("design:type", Function),
1265
+ __metadata("design:paramtypes", [Object, Object]),
1266
+ __metadata("design:returntype", void 0)
1267
+ ], CollectionView.prototype, "onItemTemplatesChanged", null);
1268
+ __decorate([
1269
+ profile,
1270
+ __metadata("design:type", Function),
1271
+ __metadata("design:paramtypes", [Object]),
1272
+ __metadata("design:returntype", void 0)
1273
+ ], CollectionView.prototype, "updateSpanCount", null);
1274
+ __decorate([
1275
+ profile,
1276
+ __metadata("design:type", Function),
1277
+ __metadata("design:paramtypes", []),
1278
+ __metadata("design:returntype", void 0)
1279
+ ], CollectionView.prototype, "updateInnerSize", null);
1280
+ __decorate([
1281
+ profile,
1282
+ __metadata("design:type", Function),
1283
+ __metadata("design:paramtypes", [Object, Object]),
1284
+ __metadata("design:returntype", void 0)
1285
+ ], CollectionView.prototype, "_onColWidthPropertyChanged", null);
1286
+ __decorate([
1287
+ profile,
1288
+ __metadata("design:type", Function),
1289
+ __metadata("design:paramtypes", [Object, Object]),
1290
+ __metadata("design:returntype", void 0)
1291
+ ], CollectionView.prototype, "_onRowHeightPropertyChanged", null);
1292
+ __decorate([
1293
+ profile,
1294
+ __metadata("design:type", Function),
1295
+ __metadata("design:paramtypes", [Number, Number, Number, Number]),
1296
+ __metadata("design:returntype", void 0)
1297
+ ], CollectionView.prototype, "onLayout", null);
1298
+ __decorate([
1299
+ profile,
1300
+ __metadata("design:type", Function),
1301
+ __metadata("design:paramtypes", [Number, Number]),
1302
+ __metadata("design:returntype", void 0)
1303
+ ], CollectionView.prototype, "onMeasure", null);
1304
+ __decorate([
1305
+ profile,
1306
+ __metadata("design:type", Function),
1307
+ __metadata("design:paramtypes", [Object, Object]),
1308
+ __metadata("design:returntype", void 0)
1061
1309
  ], CollectionView.prototype, "refresh", null);
1310
+ __decorate([
1311
+ profile,
1312
+ __metadata("design:type", Function),
1313
+ __metadata("design:paramtypes", [Object]),
1314
+ __metadata("design:returntype", void 0)
1315
+ ], CollectionView.prototype, "_setPadding", null);
1316
+ __decorate([
1317
+ profile,
1318
+ __metadata("design:type", Function),
1319
+ __metadata("design:paramtypes", [Object]),
1320
+ __metadata("design:returntype", void 0)
1321
+ ], CollectionView.prototype, "createComposedAdapter", null);
1322
+ __decorate([
1323
+ profile,
1324
+ __metadata("design:type", Function),
1325
+ __metadata("design:paramtypes", []),
1326
+ __metadata("design:returntype", void 0)
1327
+ ], CollectionView.prototype, "clearTemplateTypes", null);
1328
+ __decorate([
1329
+ profile,
1330
+ __metadata("design:type", Function),
1331
+ __metadata("design:paramtypes", [Number]),
1332
+ __metadata("design:returntype", void 0)
1333
+ ], CollectionView.prototype, "getItemViewType", null);
1334
+ __decorate([
1335
+ profile,
1336
+ __metadata("design:type", Function),
1337
+ __metadata("design:paramtypes", [String]),
1338
+ __metadata("design:returntype", Number)
1339
+ ], CollectionView.prototype, "templateKeyToNativeItem", null);
1340
+ __decorate([
1341
+ profile,
1342
+ __metadata("design:type", Function),
1343
+ __metadata("design:paramtypes", []),
1344
+ __metadata("design:returntype", void 0)
1345
+ ], CollectionView.prototype, "disposeViewHolderViews", null);
1062
1346
  __decorate([
1063
1347
  profile,
1064
1348
  __metadata("design:type", Function),
1065
1349
  __metadata("design:paramtypes", [android.view.ViewGroup, Number]),
1066
1350
  __metadata("design:returntype", void 0)
1067
1351
  ], CollectionView.prototype, "onCreateViewHolder", null);
1352
+ __decorate([
1353
+ profile,
1354
+ __metadata("design:type", Function),
1355
+ __metadata("design:paramtypes", [String, View, Number, Object, Object]),
1356
+ __metadata("design:returntype", void 0)
1357
+ ], CollectionView.prototype, "notifyForItemAtIndex", null);
1068
1358
  __decorate([
1069
1359
  profile,
1070
1360
  __metadata("design:type", Function),