OSDN Git Service

CMFM: Fix FC caused by accessing ui outside of UI thread
authorJorge Ruesga <jorge@ruesga.com>
Mon, 7 Jan 2013 21:45:27 +0000 (22:45 +0100)
committerJorge Ruesga <jorge@ruesga.com>
Mon, 7 Jan 2013 21:53:05 +0000 (22:53 +0100)
Patchset 2: Formatting

Change-Id: I1323b4f92a64dd23afe4aa28d3569ce01d72c039
Signed-off-by: jruesga <jorge@ruesga.com>
src/com/cyanogenmod/filemanager/ui/widgets/NavigationView.java
src/com/cyanogenmod/filemanager/util/ExceptionUtil.java

index afcf457..6974669 100644 (file)
@@ -906,14 +906,20 @@ public class NavigationView extends RelativeLayout implements
                          *
                          * @param out Fade out (true); Fade in (false)
                          */
-                        void fadeEfect(boolean out) {
-                            Animation fadeAnim = out ?
-                                                     new AlphaAnimation(1, 0) :
-                                                     new AlphaAnimation(0, 1);
-                            fadeAnim.setDuration(50L);
-                            fadeAnim.setFillAfter(true);
-                            fadeAnim.setInterpolator(new AccelerateInterpolator());
-                            NavigationView.this.startAnimation(fadeAnim);
+                        void fadeEfect(final boolean out) {
+                            Activity activity = (Activity)getContext();
+                            activity.runOnUiThread(new Runnable() {
+                                @Override
+                                public void run() {
+                                    Animation fadeAnim = out ?
+                                            new AlphaAnimation(1, 0) :
+                                            new AlphaAnimation(0, 1);
+                                    fadeAnim.setDuration(50L);
+                                    fadeAnim.setFillAfter(true);
+                                    fadeAnim.setInterpolator(new AccelerateInterpolator());
+                                    NavigationView.this.startAnimation(fadeAnim);
+                                }
+                            });
                         }
                    };
             task.execute(fNewDir);
index 658a28c..e7d6074 100644 (file)
@@ -293,6 +293,7 @@ public final class ExceptionUtil {
                                         Object result = CommandHelper.reexecute(
                                                 context, executable, null);
                                         if (relaunchable.getTask() != null) {
+                                            relaunchable.getTask().cancel(true);
                                             relaunchable.getTask().execute(result);
                                         }
                                     }