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

Commit 51e49c9b authored by herriojr's avatar herriojr Committed by Jon Herriott
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 2e7f90df
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -651,6 +651,7 @@ public class NavigationActivity extends Activity
                intent.putExtra(EXTRA_ADD_TO_HISTORY, false);
                initNavigation(NavigationActivity.this.mCurrentNavigationView, false, intent);
            }
            getCurrentNavigationView().refresh(true);
        }
    }

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

    private NavigationTask mNavigationTask;

    /**
     * @hide
     */
@@ -814,7 +816,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;
        }

@@ -1024,9 +1026,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);
    }

    /**
@@ -1109,6 +1111,8 @@ BreadcrumbListener, OnSelectionChangedListener, OnSelectionListener, OnRequestRe
                FileSystemObject dir = 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) {