コード例 #1
0
        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;
                    }
                }
            }
        }
コード例 #2
0
        /// <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);
        }
コード例 #3
0
        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));
            }
        }
コード例 #4
0
 /// <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
     }
 }
コード例 #5
0
        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;
            }
        }
コード例 #6
0
        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);
        }