Revision a8cbefce
Added by Leszek Koltunski almost 6 years ago
| src/main/java/org/distorted/effect/SizeChangeEffect.java | ||
|---|---|---|
| 253 | 253 |
|
| 254 | 254 |
public static void enableEffects() |
| 255 | 255 |
{
|
| 256 |
Method method=null;
|
|
| 256 |
Method method; |
|
| 257 | 257 |
|
| 258 | 258 |
for(Type type: Type.values()) |
| 259 | 259 |
{
|
| 260 | 260 |
try |
| 261 | 261 |
{
|
| 262 |
method = type.effect.getMethod("enable");
|
|
| 262 |
method = type.effect.getDeclaredMethod("enable"); // enable not public, thus getDeclaredMethod
|
|
| 263 | 263 |
} |
| 264 | 264 |
catch(NoSuchMethodException ex) |
| 265 | 265 |
{
|
| 266 |
android.util.Log.e("SizeChangeEffect", "exception getting method: "+ex.getMessage());
|
|
| 266 |
android.util.Log.e("SizeChangeEffect", type.effect.getSimpleName()+": exception getting method: "+ex.getMessage());
|
|
| 267 |
method = null; |
|
| 267 | 268 |
} |
| 268 | 269 |
|
| 269 | 270 |
try |
| 270 | 271 |
{
|
| 271 |
method.invoke(null); |
|
| 272 |
if( method!=null ) method.invoke(null);
|
|
| 272 | 273 |
} |
| 273 | 274 |
catch(Exception ex) |
| 274 | 275 |
{
|
| 275 |
android.util.Log.e("SizeChangeEffect", "exception invoking method: "+ex.getMessage());
|
|
| 276 |
android.util.Log.e("SizeChangeEffect", type.effect.getSimpleName()+": exception invoking method: "+ex.getMessage());
|
|
| 276 | 277 |
} |
| 277 | 278 |
} |
| 278 | 279 |
} |
| src/main/java/org/distorted/effect/UnscrambleEffect.java | ||
|---|---|---|
| 215 | 215 |
@SuppressWarnings("unused")
|
| 216 | 216 |
public static void enableEffects() |
| 217 | 217 |
{
|
| 218 |
Method method=null;
|
|
| 218 |
Method method; |
|
| 219 | 219 |
|
| 220 | 220 |
for(Type type: Type.values()) |
| 221 | 221 |
{
|
| 222 | 222 |
try |
| 223 | 223 |
{
|
| 224 |
method = type.effect.getMethod("enable");
|
|
| 224 |
method = type.effect.getDeclaredMethod("enable"); // enable not public, thus getDeclaredMethod
|
|
| 225 | 225 |
} |
| 226 | 226 |
catch(NoSuchMethodException ex) |
| 227 | 227 |
{
|
| 228 |
android.util.Log.e("UnscrambleEffect", "exception getting method: "+ex.getMessage());
|
|
| 228 |
android.util.Log.e("UnscrambleEffect", type.effect.getSimpleName()+": exception getting method: "+ex.getMessage());
|
|
| 229 |
method = null; |
|
| 229 | 230 |
} |
| 230 | 231 |
|
| 231 | 232 |
try |
| 232 | 233 |
{
|
| 233 |
method.invoke(null); |
|
| 234 |
if( method!=null ) method.invoke(null);
|
|
| 234 | 235 |
} |
| 235 | 236 |
catch(Exception ex) |
| 236 | 237 |
{
|
| 237 |
android.util.Log.e("UnscrambleEffect", "exception invoking method: "+ex.getMessage());
|
|
| 238 |
android.util.Log.e("UnscrambleEffect", type.effect.getSimpleName()+": exception invoking method: "+ex.getMessage());
|
|
| 238 | 239 |
} |
| 239 | 240 |
} |
| 240 | 241 |
} |
Also available in: Unified diff
fix a bug: in certain places when we use reflection, it needs to be getDeclaredMethod and not getMethod because the methods are not public!