diff options
author | herriojr <jherriott@cyngn.com> | 2015-07-28 14:52:47 -0700 |
---|---|---|
committer | herriojr <jherriott@cyngn.com> | 2015-07-31 11:25:41 -0700 |
commit | 7b09bb0f1390b72d0ac18484721998eaf805e605 (patch) | |
tree | 444de0ecac860860db75df424cb43d5b3e44d86d /src/com/cyanogenmod/filemanager/activities/NavigationActivity.java | |
parent | f328e4f79e12fd724551f4525f3afe3fa840e11a (diff) | |
download | android_packages_apps_CMFileManager-7b09bb0f1390b72d0ac18484721998eaf805e605.tar.gz android_packages_apps_CMFileManager-7b09bb0f1390b72d0ac18484721998eaf805e605.tar.bz2 android_packages_apps_CMFileManager-7b09bb0f1390b72d0ac18484721998eaf805e605.zip |
Made NavigationView reliant on FileObserver to keep up to date.
We no longer deal with having to refresh a directory upon reentering.
Instead we now just listen on the directory for changes and update as
necessary. This will make it much more difficult to get out of sync
with the file system in pretty much all situations.
Changed per comments on patch to no longer do refreshes for the list
when items change as the FileObserver handles all of this.
Change-Id: I28a6af965708ce76107a09d6b931f4c7bafb8365
Ticket: QRDL-932
Diffstat (limited to 'src/com/cyanogenmod/filemanager/activities/NavigationActivity.java')
-rwxr-xr-x | src/com/cyanogenmod/filemanager/activities/NavigationActivity.java | 44 |
1 files changed, 1 insertions, 43 deletions
diff --git a/src/com/cyanogenmod/filemanager/activities/NavigationActivity.java b/src/com/cyanogenmod/filemanager/activities/NavigationActivity.java index d65568fa..ac4c9b29 100755 --- a/src/com/cyanogenmod/filemanager/activities/NavigationActivity.java +++ b/src/com/cyanogenmod/filemanager/activities/NavigationActivity.java @@ -297,20 +297,6 @@ public class NavigationActivity extends Activity } } else if (intent.getAction().compareTo( - FileManagerSettings.INTENT_FILE_CHANGED) == 0) { - // Retrieve the file that was changed - String file = - intent.getStringExtra(FileManagerSettings.EXTRA_FILE_CHANGED_KEY); - try { - FileSystemObject fso = CommandHelper.getFileInfo(context, file, null); - if (fso != null) { - getCurrentNavigationView().refresh(fso); - } - } catch (Exception e) { - ExceptionUtil.translateException(context, e, true, false); - } - - } else if (intent.getAction().compareTo( FileManagerSettings.INTENT_THEME_CHANGED) == 0) { applyTheme(); @@ -644,7 +630,6 @@ public class NavigationActivity extends Activity if (curDir != null) { VirtualMountPointConsole vc = VirtualMountPointConsole.getVirtualConsoleForPath( mNavigationViews[mCurrentNavigationView].getCurrentDir()); - getCurrentNavigationView().refresh(true); if (vc != null && !vc.isMounted()) { onRequestBookmarksRefresh(); removeUnmountedHistory(); @@ -1942,10 +1927,6 @@ public class NavigationActivity extends Activity if (searchInfo != null && searchInfo.isSuccessNavigation()) { //Navigate to previous history back(); - } else { - // I don't know is the search view was changed, so try to do a refresh - // of the navigation view - getCurrentNavigationView().refresh(true); } } // reset bookmarks list to default as the user could have set a @@ -1982,13 +1963,6 @@ public class NavigationActivity extends Activity */ @Override public void onRequestRefresh(Object o, boolean clearSelection) { - if (o instanceof FileSystemObject) { - // Refresh only the item - this.getCurrentNavigationView().refresh((FileSystemObject)o); - } else if (o == null) { - // Refresh all - getCurrentNavigationView().refresh(); - } if (clearSelection) { this.getCurrentNavigationView().onDeselectAll(); } @@ -2008,13 +1982,8 @@ public class NavigationActivity extends Activity @Override public void onRequestRemove(Object o, boolean clearSelection) { if (o instanceof FileSystemObject) { - // Remove from view - this.getCurrentNavigationView().removeItem((FileSystemObject)o); - //Remove from history removeFromHistory((FileSystemObject)o); - } else { - onRequestRefresh(null, clearSelection); } if (clearSelection) { this.getCurrentNavigationView().onDeselectAll(); @@ -2367,19 +2336,8 @@ public class NavigationActivity extends Activity } } catch (Exception e) { - // Notify the user + // Do nothing, objects should be removed by the FileObserver in NavigationView ExceptionUtil.translateException(this, e); - - // Remove the object - if (e instanceof FileNotFoundException || e instanceof NoSuchFileOrDirectory) { - // If have a FileSystemObject reference then there is no need to search - // the path (less resources used) - if (item instanceof FileSystemObject) { - getCurrentNavigationView().removeItem((FileSystemObject)item); - } else { - getCurrentNavigationView().removeItem((String)item); - } - } return; } |