コード例 #1
0
        //@Override
        public void onDismiss(ViewGroup listView, int[] reverseSortedPositions)
        {
            base.onDismiss(listView, reverseSortedPositions);

            /* Adjust the pending timeout positions accordingly wrt the given dismissed positions */
            //noinspection UseSparseArrays
            Dictionary <int, TimeoutRunnable> newRunnables = new Dictionary <int, TimeoutRunnable>();

            foreach (int position in reverseSortedPositions)
            {
                foreach (int key in mRunnables.Keys)
                {
                    TimeoutRunnable runnable = mRunnables[key];
                    if (key > position)
                    {
                        int ntemp = key;
                        ntemp--;
                        runnable.setPosition(ntemp);
                        newRunnables.Add(ntemp, runnable);
                    }
                    else if (key != position)
                    {
                        newRunnables.Add(key, runnable);
                    }
                }

                mRunnables.Clear();

                //mRunnables.putAll(newRunnables);
                mRunnables = newRunnables.ToDictionary(k => k.Key, v => v.Value);
                newRunnables.Clear();
            }
        }
コード例 #2
0
        //@Override
        public override void onUndoShown(View view, int position)
        {
            base.onUndoShown(view, position);
            TimeoutRunnable timeoutRunnable = new TimeoutRunnable(position, this);

            mRunnables.Add(position, timeoutRunnable);
            mHandler.PostDelayed(timeoutRunnable, mTimeoutMs);
        }