示例#1
0
  @Override
  public boolean startPlay(String path) {
    final BaseViewAdapter adapter = internalAdapter();

    if (adapter == null
        || adapter.getSavedState() != null
        || mView.coreView().isPlaying()
        || !new File(path).exists()) {
      return false;
    }
    return adapter.startPlay(path);
  }
示例#2
0
  @Override
  public boolean startRecord(String path) {
    final BaseViewAdapter adapter = internalAdapter();

    if (adapter == null
        || adapter.getSavedState() != null
        || mView.coreView().isRecording()
        || !deleteDirectory(new File(path))
        || !createDirectory(path, true)) {
      return false;
    }
    return adapter.startRecord(path);
  }
示例#3
0
  @Override
  public void onSaveInstanceState(Bundle outState, String path) {
    final BaseViewAdapter adapter = internalAdapter();

    if (adapter == null) {
      Log.w(TAG, "onSaveInstanceState fail due to no view adapter");
    } else {
      final LogHelper log = new LogHelper();
      Bundle state = adapter.getSavedState();

      if (state == null) {
        final String filename = new File(path, "resume.vg").getPath();
        final String playFile = new File(path, "playresume.vg").getPath();

        state = new Bundle();
        adapter.onSaveInstanceState(state);
        if (mView.coreView().isPlaying()) {
          if (saveToFile(playFile)) {
            Log.d(TAG, "Auto save playing shapes to " + playFile);
            state.putString("playFile", playFile);
          }
          if (saveToFile(filename, mView.coreView().backDoc())) {
            Log.d(TAG, "Auto save to " + filename);
            state.putString("bakFile", filename);
          }
        } else {
          if (saveToFile(filename)) {
            Log.d(TAG, "Auto save to " + filename);
            state.putString("bakFile", filename);
          }
        }
        state.putBoolean("readOnly", cmdView().isReadOnly());
      }
      outState.putBundle("vg", state);
      log.r();
    }
  }