diff options
| author | Linux Build Service Account <lnxbuild@localhost> | 2016-04-05 00:14:17 -0700 |
|---|---|---|
| committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2016-04-05 00:14:17 -0700 |
| commit | 614f0b7869b026768c33c4fb7e82850e13e17bfa (patch) | |
| tree | 845ee48f5ce9cf1292762f2cc85c7f58256e1753 | |
| parent | b1010c0ae29a2789aed26da3aafab0509d6457ac (diff) | |
| parent | 432ad6e8048d3677de77d070bf571bea3d4831ea (diff) | |
| download | android_packages_apps_Gallery2-614f0b7869b026768c33c4fb7e82850e13e17bfa.tar.gz android_packages_apps_Gallery2-614f0b7869b026768c33c4fb7e82850e13e17bfa.tar.bz2 android_packages_apps_Gallery2-614f0b7869b026768c33c4fb7e82850e13e17bfa.zip | |
Merge "Gallery2: Adding message in failed case of SeeStraight" into android_ui.lnx.1.2-dev
| -rwxr-xr-x | res/values/strings.xml | 2 | ||||
| -rw-r--r-- | src/com/android/gallery3d/filtershow/filters/SeeStraightActs.java | 19 |
2 files changed, 19 insertions, 2 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml index 516c5be99..7d33f8a15 100755 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -1191,4 +1191,6 @@ CHAR LIMIT = NONE] --> <string name="truescanner_white">WhiteBoard</string> <string name="hazebuster_acts">Haze Buster</string> <string name="seestraight_acts">See Straight</string> + <string name="seestraight_input_image_is_small">Input image is too small to process.</string> + <string name="seestraight_process_fail">Couldn\'t process the image.</string> </resources> diff --git a/src/com/android/gallery3d/filtershow/filters/SeeStraightActs.java b/src/com/android/gallery3d/filtershow/filters/SeeStraightActs.java index e9489595e..7ecae02cf 100644 --- a/src/com/android/gallery3d/filtershow/filters/SeeStraightActs.java +++ b/src/com/android/gallery3d/filtershow/filters/SeeStraightActs.java @@ -31,6 +31,7 @@ package com.android.gallery3d.filtershow.filters; import android.graphics.Bitmap; import android.util.Log; +import android.widget.Toast; import com.android.gallery3d.R; import com.android.gallery3d.filtershow.editors.SeeStraightEditor; @@ -39,6 +40,7 @@ public class SeeStraightActs extends SimpleImageFilter { public static final String SERIALIZATION_NAME = "SeeStraightActs"; private static final int MIN_WIDTH = 512; private static final int MIN_HEIGHT = 512; + private static final int MIN_INPUT_REQUIREMENT = 640; private static final boolean DEBUG = true; private static boolean isSeeStraightEnabled = true; @@ -83,11 +85,24 @@ public class SeeStraightActs extends SimpleImageFilter { if(width <= MIN_WIDTH && height <= MIN_HEIGHT) return bitmap; + if(width <= MIN_INPUT_REQUIREMENT || height <= MIN_INPUT_REQUIREMENT) { + sActivity.runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(sActivity, sActivity.getResources().getString(R.string.seestraight_input_image_is_small), Toast.LENGTH_SHORT).show(); + } + }); + return bitmap; + } + Bitmap dstBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); int[] outputRoi = processImage(width, height, bitmap, dstBitmap); if(outputRoi == null) { - printDebug("See Straight filter is not effective"); - return dstBitmap; + sActivity.runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(sActivity, sActivity.getResources().getString(R.string.seestraight_process_fail), Toast.LENGTH_SHORT).show(); + } + }); + return bitmap; } dstBitmap = Bitmap.createBitmap(dstBitmap, outputRoi[0], outputRoi[1], outputRoi[2], outputRoi[3]); return dstBitmap; |
