OSDN Git Service

Fixed search to actually open the clicked folder
authorherriojr <jherriott@cyngn.com>
Wed, 5 Aug 2015 19:24:56 +0000 (12:24 -0700)
committerGerrit Code Review <gerrit@cyanogenmod.org>
Thu, 6 Aug 2015 00:01:39 +0000 (17:01 -0700)
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

src/com/cyanogenmod/filemanager/activities/NavigationActivity.java
src/com/cyanogenmod/filemanager/ui/widgets/NavigationView.java

index 9ca3602..e4d6b10 100755 (executable)
@@ -654,6 +654,7 @@ public class NavigationActivity extends Activity
                 intent.putExtra(EXTRA_ADD_TO_HISTORY, false);
                 initNavigation(NavigationActivity.this.mCurrentNavigationView, false, intent);
             }
+            getCurrentNavigationView().refresh(true);
         }
     }
 
index 3510f2c..7793a3d 100755 (executable)
@@ -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) {