Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5a9f961a authored by Jorge Ruesga's avatar Jorge Ruesga
Browse files

CMFM: Fix navigation view fade effect



Use OnRelaunchCommandResult listener to finish the fade effect instead of doing in
the async task, to ensure that cancels and failures results will finalize the fade effect.

Change-Id: I872a4f468670dc425d96c9c7dfd5fe05b8d86b89
Signed-off-by: default avatarjruesga <jorge@ruesga.com>
parent dd954c7d
Loading
Loading
Loading
Loading
+22 −6
Original line number Diff line number Diff line
@@ -63,6 +63,7 @@ import com.cyanogenmod.filemanager.ui.widgets.FlingerListView.OnItemFlingerRespo
import com.cyanogenmod.filemanager.util.CommandHelper;
import com.cyanogenmod.filemanager.util.DialogHelper;
import com.cyanogenmod.filemanager.util.ExceptionUtil;
import com.cyanogenmod.filemanager.util.ExceptionUtil.OnRelaunchCommandResult;
import com.cyanogenmod.filemanager.util.FileHelper;
import com.cyanogenmod.filemanager.util.StorageHelper;

@@ -828,7 +829,7 @@ public class NavigationView extends RelativeLayout implements
                                    }
                                }

                                //Capture exception
                                //Capture exception (attach task, and use listener to do the anim)
                                ExceptionUtil.attachAsyncTask(
                                    ex,
                                    new AsyncTask<Object, Integer, Boolean>() {
@@ -845,16 +846,31 @@ public class NavigationView extends RelativeLayout implements
                                                                files, addToHistory,
                                                                isNewHistory, hasChanged,
                                                                searchInfo, fNewDir, scrollTo);

                                                        // Do animation
                                                        fadeEfect(false);
                                                    }
                                                });
                                            return Boolean.TRUE;
                                        }

                                    });
                                ExceptionUtil.translateException(getContext(), ex);
                                final OnRelaunchCommandResult exListener =
                                        new OnRelaunchCommandResult() {
                                    @Override
                                    public void onSuccess() {
                                        // Do animation
                                        fadeEfect(false);
                                    }
                                    @Override
                                    public void onFailed(Throwable cause) {
                                        // Do animation
                                        fadeEfect(false);
                                    }
                                    @Override
                                    public void onCancelled() {
                                        // Do animation
                                        fadeEfect(false);
                                    }
                                };
                                ExceptionUtil.translateException(
                                        getContext(), ex, false, true, exListener);
                            }
                            return null;
                        }