Skip to content

Commit 6147c74

Browse files
committed
chore:tsc
1 parent 9832334 commit 6147c74

File tree

1 file changed

+17
-20
lines changed

1 file changed

+17
-20
lines changed

src/collectionview/index.android.ts

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ export class CollectionView extends CollectionViewBase {
172172
recycledViewPool: com.nativescript.collectionview.RecycledViewPool;
173173
recycledViewPoolDisposeListener: com.nativescript.collectionview.RecycledViewPool.ViewPoolListener;
174174

175-
176175
mInPropertiesSet = false;
177176
mShouldUpdateInnerSize = false;
178177
mShouldUpdateSpanCount = false;
@@ -263,10 +262,10 @@ export class CollectionView extends CollectionViewBase {
263262
layoutManager = new com.nativescript.collectionview.PreCachingGridLayoutManager(this._context, 1);
264263
if (this.hasListeners(CollectionView.layoutCompletedEvent)) {
265264
(layoutManager as com.nativescript.collectionview.GridLayoutManager).layoutCompletedListener = new com.nativescript.collectionview.GridLayoutManager.LayoutCompletedListener({
266-
onLayoutCompleted:()=>{
267-
this.notify({eventName:CollectionView.layoutCompletedEvent})
265+
onLayoutCompleted: () => {
266+
this.notify({ eventName: CollectionView.layoutCompletedEvent });
268267
}
269-
})
268+
});
270269
}
271270
// layoutManager = new PreCachingGridLayoutManager(this._context, 1);
272271
// (layoutManager as any).owner = new WeakRef(this);
@@ -276,7 +275,7 @@ export class CollectionView extends CollectionViewBase {
276275
nativeView.layoutManager = layoutManager;
277276

278277
nativeView.sizeChangedListener = new com.nativescript.collectionview.SizeChangedListener({
279-
onLayout:(changed, left, top, right, bottom) => changed && this.onLayout(left, top, right, bottom),
278+
onLayout: (changed, left, top, right, bottom) => changed && this.onLayout(left, top, right, bottom),
280279
onMeasure: (widthMeasureSpec, heightMeasureSpec) => this.onMeasure(widthMeasureSpec, heightMeasureSpec)
281280
});
282281
this.spanSize = this._getSpanSize;
@@ -625,7 +624,7 @@ export class CollectionView extends CollectionViewBase {
625624
private enumerateViewHolders<T = any>(cb: (v: CollectionViewCellHolder) => T) {
626625
let result: T, v: CollectionViewCellHolder;
627626
for (let it = this._viewHolders.values(), cellItemView: CollectionViewCellHolder = null; (cellItemView = it.next().value); ) {
628-
if (cellItemView['position'] === undefined ) {
627+
if (cellItemView['position'] === undefined) {
629628
continue;
630629
}
631630
result = cb(cellItemView);
@@ -638,7 +637,7 @@ export class CollectionView extends CollectionViewBase {
638637
private async enumerateViewHoldersAsync<T = any>(cb: (v: CollectionViewCellHolder) => Promise<T>) {
639638
let result: T, v: CollectionViewCellHolder;
640639
for (let it = this._viewHolders.values(), cellItemView: CollectionViewCellHolder = null; (cellItemView = it.next().value); ) {
641-
if (cellItemView['position'] === undefined ) {
640+
if (cellItemView['position'] === undefined) {
642641
continue;
643642
}
644643
result = await cb(cellItemView);
@@ -811,32 +810,31 @@ export class CollectionView extends CollectionViewBase {
811810
const p = CollectionViewBase.plugins[k];
812811
p.onLayout && p.onLayout(this, left, top, right, bottom);
813812
});
814-
815813
}
816814
@profile
817815
public onMeasure(widthMeasureSpec: number, heightMeasureSpec: number) {
818-
const lastLayoutKey = this._lastLayoutKey
816+
const lastLayoutKey = this._lastLayoutKey;
819817
this.updateInnerSize();
820818

821819
if (lastLayoutKey !== this._lastLayoutKey) {
822820
//we need to refresh visible cells so that they measure to the new size
823821
// for some reason it gets animated even with setSupportsChangeAnimations(false)
824822
// so we clear until it is done
825823
const nativeView = this.nativeViewProtected;
826-
const animator = nativeView.getItemAnimator()
824+
const animator = nativeView.getItemAnimator();
827825
nativeView.setItemAnimator(null);
828-
this.refreshVisibleItems()
826+
this.refreshVisibleItems();
829827
setTimeout(() => {
830828
nativeView.setItemAnimator(animator);
831829
}, 0);
832830
}
833831
const p = CollectionViewBase.plugins[this.layoutStyle];
834832
if (p && p.onMeasure) {
835-
p.onMeasure(this, widthMeasureSpec,heightMeasureSpec);
833+
p.onMeasure(this, widthMeasureSpec, heightMeasureSpec);
836834
}
837835
this.plugins.forEach((k) => {
838836
const p = CollectionViewBase.plugins[k];
839-
p.onMeasure && p.onMeasure(this, widthMeasureSpec,heightMeasureSpec);
837+
p.onMeasure && p.onMeasure(this, widthMeasureSpec, heightMeasureSpec);
840838
});
841839
}
842840
public onSourceCollectionChanged(event: ChangedData<any>) {
@@ -940,8 +938,7 @@ export class CollectionView extends CollectionViewBase {
940938
if (!view) {
941939
return;
942940
}
943-
const ids = Array.from( this.bindedViewHolders)
944-
.sort((a, b) => a - b);
941+
const ids = Array.from(this.bindedViewHolders).sort((a, b) => a - b);
945942
this._listViewAdapter.notifyItemRangeChanged(ids[0], ids[ids.length - 1] - ids[0] + 1);
946943
}
947944
public isItemAtIndexVisible(index: number): boolean {
@@ -1179,7 +1176,7 @@ export class CollectionView extends CollectionViewBase {
11791176

11801177
@profile
11811178
public onCreateViewHolder(parent: android.view.ViewGroup, viewType: number) {
1182-
const start = Date.now()
1179+
const start = Date.now();
11831180
let view: View = this.getViewForViewType(ListViewViewTypes.ItemView, this.getKeyByValue(viewType));
11841181
const isNonSync = view === undefined;
11851182
// dont create unecessary StackLayout if template.createView returns. Will happend when not using Vue or angular
@@ -1235,7 +1232,7 @@ export class CollectionView extends CollectionViewBase {
12351232
return args as any;
12361233
}
12371234

1238-
bindedViewHolders: Set<number> = new Set()
1235+
bindedViewHolders: Set<number> = new Set();
12391236
@profile
12401237
public onBindViewHolder(holder: CollectionViewCellHolder, position: number) {
12411238
const start = Date.now();
@@ -1246,11 +1243,11 @@ export class CollectionView extends CollectionViewBase {
12461243
const isNonSync = holder['defaultItemView'] === true;
12471244
view = isNonSync ? (view as ContentView).content : view;
12481245
const bindingContext = this._prepareItem(view, position);
1249-
if (holder['position'] !==undefined) {
1250-
this.bindedViewHolders.delete(holder['position'])
1246+
if (holder['position'] !== undefined) {
1247+
this.bindedViewHolders.delete(holder['position']);
12511248
}
12521249
holder['position'] = position;
1253-
this.bindedViewHolders.add(holder['position'])
1250+
this.bindedViewHolders.add(holder['position']);
12541251

12551252
const args = this.notifyForItemAtIndex(CollectionViewBase.itemLoadingEvent, view, position, bindingContext, holder);
12561253

0 commit comments

Comments
 (0)