diff options
author | Elliott Hughes <enh@google.com> | 2014-01-07 01:23:26 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2014-01-07 01:23:27 +0000 |
commit | ecd55f6aff7f62d7a9dd66460fe4e4e385539aab (patch) | |
tree | 92e900ae9ebecc948a5af77814f2fea28a748479 | |
parent | 26d8ecc39ebd315b6063af64b467ebb57bc7394e (diff) | |
parent | 9b04db4b58007c3d4f7965fd4523e86170a9595d (diff) | |
download | VideoEditor-idea133-weekly-release.tar.gz |
Merge "Save the export progress when rotating the phone"idea133-weekly-release
-rwxr-xr-x | src/com/android/videoeditor/VideoEditorActivity.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/com/android/videoeditor/VideoEditorActivity.java b/src/com/android/videoeditor/VideoEditorActivity.java index 01729c9..8dc1588 100755 --- a/src/com/android/videoeditor/VideoEditorActivity.java +++ b/src/com/android/videoeditor/VideoEditorActivity.java @@ -137,6 +137,10 @@ public class VideoEditorActivity extends VideoEditorBaseActivity // Threshold in width dip for showing title in action bar. private static final int SHOW_TITLE_THRESHOLD_WIDTH_DIP = 1000; + // To store the export progress when the activity is destroyed + private static final String EXPORT_PROGRESS = "export_progress"; + private int mExportProgress; + private final TimelineRelativeLayout.LayoutCallback mLayoutCallback = new TimelineRelativeLayout.LayoutCallback() { @@ -390,9 +394,11 @@ public class VideoEditorActivity extends VideoEditorBaseActivity mRestartPreview = savedInstanceState.getBoolean(STATE_PLAYING); mCaptureMediaUri = savedInstanceState.getParcelable(STATE_CAPTURE_URI); mMediaLayoutSelectedPos = savedInstanceState.getInt(STATE_SELECTED_POS_ID, -1); + mExportProgress = savedInstanceState.getInt(EXPORT_PROGRESS); } else { mRestartPreview = false; mMediaLayoutSelectedPos = -1; + mExportProgress = 0; } // Compute the activity width @@ -490,6 +496,7 @@ public class VideoEditorActivity extends VideoEditorBaseActivity outState.putBoolean(STATE_PLAYING, isPreviewPlaying() || mRestartPreview); outState.putParcelable(STATE_CAPTURE_URI, mCaptureMediaUri); outState.putInt(STATE_SELECTED_POS_ID, mMediaLayout.getSelectedViewPos()); + outState.putInt(EXPORT_PROGRESS,mExportProgress); } @Override @@ -631,6 +638,7 @@ public class VideoEditorActivity extends VideoEditorBaseActivity case R.id.menu_item_export_movie: { // Present the user with a dialog to choose export options + mExportProgress = 0; showDialog(DIALOG_EXPORT_OPTIONS_ID); return true; } @@ -1438,6 +1446,7 @@ public class VideoEditorActivity extends VideoEditorBaseActivity @Override protected void onExportProgress(int progress) { if (mExportProgressDialog != null) { + mExportProgress = progress; mExportProgressDialog.setProgress(progress); } } @@ -1447,6 +1456,7 @@ public class VideoEditorActivity extends VideoEditorBaseActivity if (mExportProgressDialog != null) { mExportProgressDialog.dismiss(); mExportProgressDialog = null; + mExportProgress = 0; } } @@ -1654,11 +1664,15 @@ public class VideoEditorActivity extends VideoEditorBaseActivity mExportProgressDialog.setCanceledOnTouchOutside(false); mExportProgressDialog.show(); mExportProgressDialog.setProgressNumberFormat(""); + if (mExportProgress >= 0 && mExportProgress <= 100) { + mExportProgressDialog.setProgress(mExportProgress); + } } private void cancelExport() { ApiService.cancelExportVideoEditor(VideoEditorActivity.this, mProjectPath, mPendingExportFilename); + mExportProgress = 0; mPendingExportFilename = null; mExportProgressDialog = null; } |