@Override
  void restoreState(Bundle inState) {
    super.restoreState(inState);

    int[] rows = inState.getIntArray("rows");
    int[] cols = inState.getIntArray("cols");
    String[] notes = inState.getStringArray("notes");

    for (int i = 0; i < rows.length; i++) {
      mOldNotes.add(new NoteEntry(rows[i], cols[i], CellNote.deserialize(notes[i])));
    }
  }
  @Override
  void saveState(Bundle outState) {
    super.saveState(outState);

    int[] rows = new int[mOldNotes.size()];
    int[] cols = new int[mOldNotes.size()];
    String[] notes = new String[mOldNotes.size()];

    int i = 0;
    for (NoteEntry ne : mOldNotes) {
      rows[i] = ne.rowIndex;
      cols[i] = ne.colIndex;
      notes[i] = ne.note.serialize();
      i++;
    }

    outState.putIntArray("rows", rows);
    outState.putIntArray("cols", cols);
    outState.putStringArray("notes", notes);
  }
Ejemplo n.º 3
0
 private void push(AbstractCommand command) {
   if (command instanceof AbstractCellCommand) {
     ((AbstractCellCommand) command).setCells(mCells);
   }
   mCommandStack.push(command);
 }