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

Commit aeefe0da authored by herriojr's avatar herriojr Committed by Richard MacGregor
Browse files

Fixed search to actually open the clicked folder

When a folder was clicked in a search, what was happening is the
refresh() in onStart() was being executed after onActivityResult(), so
the changeCurrentDir() executed in onActivityResult() was being
overriden by the refresh in onStart(). Since the mCurrentDir wasn't
being set until the NavigationTask ends, it would always go back to
the original directory. The change is to make the refresh not happen
if a NavigationTask is currently under way.

Change-Id: I5c354554c9b15fc9d14b4665852b40fb6a1f8853
Ticket: QRDL-932
(cherry picked from commit c740f929)
parent 824f9ba2
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -644,6 +644,7 @@ public class NavigationFragment extends Fragment
                intent.putExtra(EXTRA_ADD_TO_HISTORY, false);
                initNavigation(NavigationFragment.this.mCurrentNavigationView, false, intent);
            }
            getCurrentNavigationView().refresh(true);
        }

        attachNavigationViewListeners();
+7 −3
Original line number Diff line number Diff line
@@ -492,6 +492,8 @@ BreadcrumbListener, OnSelectionChangedListener, OnSelectionListener, OnRequestRe
    // Restrictions
    private Map<DisplayRestrictions, Object> mRestrictions;

    private NavigationTask mNavigationTask;

    /**
     * @hide
     */
@@ -876,7 +878,7 @@ BreadcrumbListener, OnSelectionChangedListener, OnSelectionListener, OnRequestRe
     */
    public void refresh(FileSystemObject scrollTo) {
        //Check that current directory was set
        if (this.mCurrentDir == null || this.mFiles == null) {
        if (this.mCurrentDir == null || this.mFiles == null || this.mNavigationTask != null) {
            return;
        }

@@ -1096,9 +1098,9 @@ BreadcrumbListener, OnSelectionChangedListener, OnSelectionListener, OnRequestRe
            final String newDir, final boolean addToHistory,
            final boolean reload, final boolean useCurrent,
            final SearchInfoParcelable searchInfo, final FileSystemObject scrollTo) {
        NavigationTask task = new NavigationTask(useCurrent, addToHistory, reload,
        mNavigationTask = new NavigationTask(useCurrent, addToHistory, reload,
                searchInfo, scrollTo, mRestrictions, mChRooted);
        task.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR, newDir);
        mNavigationTask.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR, newDir);
    }

    /**
@@ -1193,6 +1195,8 @@ BreadcrumbListener, OnSelectionChangedListener, OnSelectionListener, OnRequestRe
                        newDirFSO : FileHelper.createFileSystemObject(new File(newDir));
                this.mOnDirectoryChangedListener.onDirectoryChanged(dir);
            }

            mNavigationTask = null;
        } finally {
            //If calling activity is search, then save the search history
            if (searchInfo != null) {