Exemplo n.º 1
0
        public void IntoChoiceMode()
        {
            if (!inChoiceMode)
            {
                if (adapter == null)
                {
                    throw new IllegalStateException("Please set adapter first");
                }

                inChoiceMode = true;

                if (choiceState == null)
                {
                    choiceState = new ChoiceState();
                }

                if (choiceObserver == null)
                {
                    choiceObserver = new ChoiceObserver(this);
                }
                adapter.RegisterAdapterDataObserver(choiceObserver);

                if (choiceModeListener != null)
                {
                    choiceModeListener.OnIntoChoiceMode(this);
                }
            }
        }
Exemplo n.º 2
0
            /**
             * Constructor called from {@link #CREATOR}
             */
            public ISavedState(Parcel ind, EasyRecyclerView recyclerView)
            {
                this.recyclerView = recyclerView;
                // Parcel 'in' has its parent(RecyclerView)'s saved state.
                // To restore it, class loader that loaded RecyclerView is required.
                IParcelable superState = (IParcelable)ind.ReadParcelable(recyclerView.Class.ClassLoader);

                mSuperState  = superState != null ? superState : EMPTY_STATE;
                inChoiceMode = (ind.ReadInt() != 0);
                choiceState  = ChoiceState.ReadFromParcel(ind);
            }
Exemplo n.º 3
0
 /**
  * Save {@code ChoiceState} to {@code Parcel}.
  */
 public static void WriteToParcel(ChoiceState state, Parcel outp)
 {
     if (state == null)
     {
         outp.WriteInt(-1);
     }
     else
     {
         int   size  = state.array.size;
         int[] array = state.array.array;
         outp.WriteInt(state.array.size);
         for (int i = 0; i < size; ++i)
         {
             outp.WriteInt(array[i]);
         }
     }
 }
Exemplo n.º 4
0
 public void WriteToParcel(Parcel dest, [GeneratedEnum] ParcelableWriteFlags flags)
 {
     dest.WriteParcelable(mSuperState, flags);
     dest.WriteInt(inChoiceMode ? 1 : 0);
     ChoiceState.WriteToParcel(choiceState, dest);
 }