diff options
| author | Jack Yoo <jyoo@codeaurora.org> | 2016-03-28 10:40:55 -0700 |
|---|---|---|
| committer | Jack Yoo <jyoo@codeaurora.org> | 2016-03-28 10:47:08 -0700 |
| commit | 432ad6e8048d3677de77d070bf571bea3d4831ea (patch) | |
| tree | 3f8f9104e86e041ddc7500c162b79ac34d9841b8 /src | |
| parent | 7f8e26df135b81971e409ce36c4aacce7b6cab58 (diff) | |
| download | android_packages_apps_Gallery2-432ad6e8048d3677de77d070bf571bea3d4831ea.tar.gz android_packages_apps_Gallery2-432ad6e8048d3677de77d070bf571bea3d4831ea.tar.bz2 android_packages_apps_Gallery2-432ad6e8048d3677de77d070bf571bea3d4831ea.zip | |
Gallery2: Adding message in failed case of SeeStraight
Adding restriction checking and show message in case of
the failure while processing SeeStraight filter.
Change-Id: I691ed701dd261e56a7d5dac44cd6d88bc9b0d1d4
CRs-Fixed: 995402
Diffstat (limited to 'src')
| -rw-r--r-- | src/com/android/gallery3d/filtershow/filters/SeeStraightActs.java | 19 |
1 files changed, 17 insertions, 2 deletions
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; |
