summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d
diff options
context:
space:
mode:
authorBobby Georgescu <georgescu@google.com>2012-10-07 15:20:44 -0700
committerBobby Georgescu <georgescu@google.com>2012-10-07 16:28:55 -0700
commit4e73c8fd7e04ce42814ac9ee304d79f2ff5160a2 (patch)
tree50116f31cf72ba3799c39e04e07f7285d8f0eb4a /src/com/android/gallery3d
parente6e562300a0968e22eda1ed413b4922b628c70ed (diff)
downloadandroid_packages_apps_Snap-4e73c8fd7e04ce42814ac9ee304d79f2ff5160a2.tar.gz
android_packages_apps_Snap-4e73c8fd7e04ce42814ac9ee304d79f2ff5160a2.tar.bz2
android_packages_apps_Snap-4e73c8fd7e04ce42814ac9ee304d79f2ff5160a2.zip
Show progress indicator dialog when saving edited image
Bug: 7301277 Change-Id: Ied4f9abeeaa950a0c78c0a652b3be4634dd96ce3
Diffstat (limited to 'src/com/android/gallery3d')
-rw-r--r--src/com/android/gallery3d/filtershow/FilterShowActivity.java35
1 files changed, 28 insertions, 7 deletions
diff --git a/src/com/android/gallery3d/filtershow/FilterShowActivity.java b/src/com/android/gallery3d/filtershow/FilterShowActivity.java
index 641259a48..89ef41744 100644
--- a/src/com/android/gallery3d/filtershow/FilterShowActivity.java
+++ b/src/com/android/gallery3d/filtershow/FilterShowActivity.java
@@ -4,6 +4,7 @@ package com.android.gallery3d.filtershow;
import android.annotation.TargetApi;
import android.app.ActionBar;
import android.app.Activity;
+import android.app.ProgressDialog;
import android.content.ContentValues;
import android.content.Intent;
import android.content.res.Resources;
@@ -12,7 +13,6 @@ import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.util.TypedValue;
-import android.view.Gravity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
@@ -27,7 +27,6 @@ import android.widget.ListView;
import android.widget.SeekBar;
import android.widget.ShareActionProvider;
import android.widget.ShareActionProvider.OnShareTargetSelectedListener;
-import android.widget.Toast;
import com.android.gallery3d.R;
import com.android.gallery3d.filtershow.cache.ImageLoader;
@@ -52,6 +51,7 @@ import com.android.gallery3d.filtershow.tools.SaveCopyTask;
import com.android.gallery3d.filtershow.ui.ImageCurves;
import java.io.File;
+import java.lang.ref.WeakReference;
import java.util.Vector;
@TargetApi(16)
@@ -93,6 +93,8 @@ public class FilterShowActivity extends Activity implements OnItemClickListener,
private boolean mSharingImage = false;
+ private WeakReference<ProgressDialog> mSavingProgressDialog;
+
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -218,6 +220,27 @@ public class FilterShowActivity extends Activity implements OnItemClickListener,
}
}
+ private void showSavingProgress() {
+ ProgressDialog progress;
+ if (mSavingProgressDialog != null) {
+ progress = mSavingProgressDialog.get();
+ if (progress != null) {
+ progress.show();
+ return;
+ }
+ }
+ // TODO: Allow cancellation of the saving process
+ progress = ProgressDialog.show(this, "", getString(R.string.saving_image), true, false);
+ mSavingProgressDialog = new WeakReference<ProgressDialog>(progress);
+ }
+
+ private void hideSavingProgress() {
+ if (mSavingProgressDialog != null) {
+ ProgressDialog progress = mSavingProgressDialog.get();
+ if (progress != null) progress.dismiss();
+ }
+ }
+
public void completeSaveImage(Uri saveUri) {
if (mSharingImage && mSharedOutputFile != null) {
// Image saved, we unblock the content provider
@@ -228,6 +251,7 @@ public class FilterShowActivity extends Activity implements OnItemClickListener,
getContentResolver().insert(uri, values);
}
setResult(RESULT_OK, new Intent().setData(saveUri));
+ hideSavingProgress();
finish();
}
@@ -243,6 +267,7 @@ public class FilterShowActivity extends Activity implements OnItemClickListener,
mSharingImage = true;
// Process and save the image in the background.
+ showSavingProgress();
mImageShow.saveImage(this, mSharedOutputFile);
return true;
}
@@ -590,11 +615,7 @@ public class FilterShowActivity extends Activity implements OnItemClickListener,
}
public void saveImage() {
- Toast toast = Toast.makeText(getBaseContext(), getString(R.string.saving_image),
- Toast.LENGTH_SHORT);
- toast.setGravity(Gravity.CENTER, 0, 0);
- toast.show();
-
+ showSavingProgress();
mImageShow.saveImage(this, null);
}