public void OnItemLongClicked(LongClickableItem longClickedItem) { // Enter selection mode SetSelectionMode(true); RefreshSelectionStateForVisibleCells(); UpdateSelectionActionButtons(); if (_Params.autoSelectFirstOnSelectionMode) { // Find the cell views holder that corresponds to the LongClickableItem parameter & mark it as toggled int numVisibleCells = GetNumVisibleCells(); for (int i = 0; i < numVisibleCells; ++i) { var cellVH = base.GetCellViewsHolder(i); if (cellVH.longClickableComponent == longClickedItem) { var model = LazyData.GetOrCreate(cellVH.ItemIndex); SelectModel(model); UpdateSelectionState(cellVH, model); break; } } } }
/// <summary> Called when a cell becomes visible </summary> /// <param name="holder"> use viewsHolder.ItemIndexto find your corresponding model and feed data into its views</param> /// <see cref="GridAdapter{TParams, TCellVH}.UpdateCellViewsHolder(TCellVH)"/> protected override void UpdateCellViewsHolder(MyCellViewsHolder holder) { var model = LazyData.GetOrCreate(holder.ItemIndex); holder.UpdateViews(model); UpdateSelectionState(holder, model); }
void RefreshSelectionStateForVisibleCells() { // Rather than calling Refresh, we retrieve the already-visible ones and update them manually (less lag) int visibleCellCount = GetNumVisibleCells(); for (int i = 0; i < visibleCellCount; ++i) { var cellVH = GetCellViewsHolder(i); UpdateSelectionState(cellVH, LazyData.GetOrCreate(cellVH.ItemIndex)); } }
/// <summary> /// Force us to decode the genotypes, if not already done /// </summary> public void Decode() { if (!ParsedAlready) { LazyData parsed = parse(UnparsedGenotypeData); notToBeDirectlyAccessedGenotypes = parsed.genotypes; sampleNamesInOrder = parsed.sampleNamesInOrder; sampleNameToOffset = parsed.sampleNameToOffset; ParsedAlready = true; UnparsedGenotypeData = null; // don't hold the unparsed data any longer // warning -- this path allows us to create a VariantContext that doesn't run validateGenotypes() // That said, it's not such an important routine -- it's just checking that the genotypes // are well formed w.r.t. the alleles list, but this will be enforced within the VCFCodec } }
void OnCellToggled(MyCellViewsHolder cellVH) { // Update the model this cell is representing var model = LazyData.GetOrCreate(cellVH.ItemIndex); if (cellVH.toggle.isOn) { SelectModel(model); cellVH.views.localScale = SELECTED_SCALE; } else { UnselectModel(model); cellVH.views.localScale = Vector3.one; } }
bool PlayPreDeleteAnimation() { var numVisibleCells = GetNumVisibleCells(); for (int i = 0; i < numVisibleCells; ++i) { var cellVH = GetCellViewsHolder(i); var m = LazyData.GetOrCreate(cellVH.ItemIndex); if (!m.isSelected) // faster to use the isSelected flag than to search through _SelectedModels { continue; } if (cellVH != null) { _WaitingForItemsToBeDeleted = true; cellVH.expandCollapseComponent.sizeChangesHandler = this; cellVH.expandCollapseComponent.OnClicked(); } } return(_WaitingForItemsToBeDeleted); }