summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/photoeditor/filters
diff options
context:
space:
mode:
authorJorge Ruesga <j.ruesga.criado@gmail.com>2012-06-12 23:28:58 +0200
committerJorge Ruesga <j.ruesga.criado@gmail.com>2012-06-14 00:46:05 +0200
commit0d21544a1af1b7a77a5990f1418c54d22a72b5d1 (patch)
tree5c99c9907361af10c5744dee40f76f801322e899 /src/com/android/gallery3d/photoeditor/filters
parentc4be10eadc24a86eb8648fd5273a68cd63e42288 (diff)
downloadandroid_packages_apps_Snap-0d21544a1af1b7a77a5990f1418c54d22a72b5d1.tar.gz
android_packages_apps_Snap-0d21544a1af1b7a77a5990f1418c54d22a72b5d1.tar.bz2
android_packages_apps_Snap-0d21544a1af1b7a77a5990f1418c54d22a72b5d1.zip
Gallery2: Check privative effects
Gallery2 has 2 effects (FaceTan and Facelift) from the privative gapps. If gapps is not present, Gallery2 gets into a FC when click on this effects. This patch checks if the permission "com.google.android.media.effects" exists and hide this 2 effects if permission not exists Patch 2: Use EffectFactory.isEffectSupported to detect if filters exists Patch 3: Make isPresent method from effect classes a static method Patch 4: Change actions classes for static calling to effects classes Change-Id: I8f6b59e57e504114835ab3283f65a72b4f6774a8
Diffstat (limited to 'src/com/android/gallery3d/photoeditor/filters')
-rw-r--r--src/com/android/gallery3d/photoeditor/filters/FaceTanFilter.java15
-rw-r--r--src/com/android/gallery3d/photoeditor/filters/FaceliftFilter.java14
2 files changed, 27 insertions, 2 deletions
diff --git a/src/com/android/gallery3d/photoeditor/filters/FaceTanFilter.java b/src/com/android/gallery3d/photoeditor/filters/FaceTanFilter.java
index c52bb8848..b7a1cf1c7 100644
--- a/src/com/android/gallery3d/photoeditor/filters/FaceTanFilter.java
+++ b/src/com/android/gallery3d/photoeditor/filters/FaceTanFilter.java
@@ -17,6 +17,7 @@
package com.android.gallery3d.photoeditor.filters;
import android.media.effect.Effect;
+import android.media.effect.EffectFactory;
import com.android.gallery3d.photoeditor.Photo;
@@ -27,10 +28,22 @@ public class FaceTanFilter extends AbstractScaleFilter {
public static final Creator<FaceTanFilter> CREATOR = creatorOf(FaceTanFilter.class);
+ private static final String EFFECT_FACE_TANNING = "com.google.android.media.effect.effects.FaceTanningEffect";
+
@Override
public void process(Photo src, Photo dst) {
- Effect effect = getEffect("com.google.android.media.effect.effects.FaceTanningEffect");
+ Effect effect = getEffect(EFFECT_FACE_TANNING);
effect.setParameter("blend", scale);
effect.apply(src.texture(), src.width(), src.height(), dst.texture());
}
+
+ /**
+ * Checks if the effect is present in the system.
+ *
+ * @return boolean true if an effect is present in the system and can be loaded
+ */
+ public static boolean isPresent() {
+ return EffectFactory.isEffectSupported(EFFECT_FACE_TANNING);
+ }
+
}
diff --git a/src/com/android/gallery3d/photoeditor/filters/FaceliftFilter.java b/src/com/android/gallery3d/photoeditor/filters/FaceliftFilter.java
index c6ad84b80..3e4fad206 100644
--- a/src/com/android/gallery3d/photoeditor/filters/FaceliftFilter.java
+++ b/src/com/android/gallery3d/photoeditor/filters/FaceliftFilter.java
@@ -17,6 +17,7 @@
package com.android.gallery3d.photoeditor.filters;
import android.media.effect.Effect;
+import android.media.effect.EffectFactory;
import com.android.gallery3d.photoeditor.Photo;
@@ -27,10 +28,21 @@ public class FaceliftFilter extends AbstractScaleFilter {
public static final Creator<FaceliftFilter> CREATOR = creatorOf(FaceliftFilter.class);
+ private static final String EFFECT_FACELIFT = "com.google.android.media.effect.effects.FaceliftEffect";
+
@Override
public void process(Photo src, Photo dst) {
- Effect effect = getEffect("com.google.android.media.effect.effects.FaceliftEffect");
+ Effect effect = getEffect(EFFECT_FACELIFT);
effect.setParameter("blend", scale);
effect.apply(src.texture(), src.width(), src.height(), dst.texture());
}
+
+ /**
+ * Checks if the effect is present in the system.
+ *
+ * @return boolean true if an effect is present in the system and can be loaded
+ */
+ public static boolean isPresent() {
+ return EffectFactory.isEffectSupported(EFFECT_FACELIFT);
+ }
}