summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicolasroard <nicolasroard@google.com>2012-10-12 00:18:51 -0700
committernicolasroard <nicolasroard@google.com>2012-10-12 00:20:14 -0700
commita7d7d05c8357049eb2accd75d35203c4be10cdbc (patch)
tree61cf4f055a48775e08db03b1fbc6ff9ed418ccd1
parent9c53ef91923931f0d8d079760777e6f4507ae48f (diff)
downloadandroid_packages_apps_Snap-a7d7d05c8357049eb2accd75d35203c4be10cdbc.tar.gz
android_packages_apps_Snap-a7d7d05c8357049eb2accd75d35203c4be10cdbc.tar.bz2
android_packages_apps_Snap-a7d7d05c8357049eb2accd75d35203c4be10cdbc.zip
Add back button handling
bug:7332980 - fix crash as well. Change-Id: Id93ee7c194df6ac5e38def2e5f0fb3c5ecc0c2e4
-rw-r--r--src/com/android/gallery3d/filtershow/FilterShowActivity.java6
-rw-r--r--src/com/android/gallery3d/filtershow/PanelController.java12
-rw-r--r--src/com/android/gallery3d/filtershow/filters/ImageFilterWBalance.java1
3 files changed, 17 insertions, 2 deletions
diff --git a/src/com/android/gallery3d/filtershow/FilterShowActivity.java b/src/com/android/gallery3d/filtershow/FilterShowActivity.java
index f2b817c17..e8770548d 100644
--- a/src/com/android/gallery3d/filtershow/FilterShowActivity.java
+++ b/src/com/android/gallery3d/filtershow/FilterShowActivity.java
@@ -712,6 +712,12 @@ public class FilterShowActivity extends Activity implements OnItemClickListener,
};
}
+ @Override
+ public void onBackPressed() {
+ if (mPanelController.onBackPressed()) {
+ finish();
+ }
+ }
// //////////////////////////////////////////////////////////////////////////////
public float getPixelsFromDip(float value) {
diff --git a/src/com/android/gallery3d/filtershow/PanelController.java b/src/com/android/gallery3d/filtershow/PanelController.java
index 918eb5b9c..a937452b3 100644
--- a/src/com/android/gallery3d/filtershow/PanelController.java
+++ b/src/com/android/gallery3d/filtershow/PanelController.java
@@ -229,6 +229,16 @@ public class PanelController implements OnClickListener {
imageShow.setPanelController(this);
}
+ public boolean onBackPressed() {
+ if (mUtilityPanel == null || !mUtilityPanel.selected()) {
+ return true;
+ }
+ mCurrentImage.resetParameter();
+ showPanel(mCurrentPanel);
+ mCurrentImage.select();
+ return false;
+ }
+
public void onNewValue(int value) {
mUtilityPanel.onNewValue(value);
}
@@ -422,7 +432,7 @@ public class PanelController implements OnClickListener {
}
case R.id.curvesButtonRGB: {
ImageCurves curves = (ImageCurves) showImageView(R.id.imageCurves);
- String ename = mCurrentImage.getContext().getString(R.string.curvesRGB);
+ String ename = curves.getContext().getString(R.string.curvesRGB);
mUtilityPanel.setEffectName(ename);
mUtilityPanel.setShowParameter(false);
curves.setUseRed(true);
diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterWBalance.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterWBalance.java
index 9d9c7e548..5e613ebce 100644
--- a/src/com/android/gallery3d/filtershow/filters/ImageFilterWBalance.java
+++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterWBalance.java
@@ -18,7 +18,6 @@ public class ImageFilterWBalance extends ImageFilter {
public Bitmap apply(Bitmap bitmap, float scaleFactor, boolean highQuality) {
int w = bitmap.getWidth();
int h = bitmap.getHeight();
- Log.v(TAG,"White Balance Call");
nativeApplyFilter(bitmap, w, h, -1,-1);
return bitmap;
}