From: jruesga Date: Sun, 28 Oct 2012 12:00:01 +0000 (+0100) Subject: Update the internal array when a item was remove X-Git-Tag: android-x86-6.0-r1~632 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=b069769936a2147057f82c41efcc6bdb796c4b05;p=android-x86%2Fpackages-apps-CMFileManager.git Update the internal array when a item was remove --- diff --git a/src/com/cyanogenmod/filemanager/ui/widgets/NavigationView.java b/src/com/cyanogenmod/filemanager/ui/widgets/NavigationView.java index 2533944..160a35e 100644 --- a/src/com/cyanogenmod/filemanager/ui/widgets/NavigationView.java +++ b/src/com/cyanogenmod/filemanager/ui/widgets/NavigationView.java @@ -657,6 +657,17 @@ public class NavigationView extends RelativeLayout implements */ public void removeItem(FileSystemObject fso) { this.mAdapter.remove(fso); + // Delete also from internal list + if (fso != null) { + int cc = this.mFiles.size()-1; + for (int i = cc; i >= 0; i--) { + FileSystemObject f = this.mFiles.get(i); + if (f != null && f.compareTo(fso) == 0) { + this.mFiles.remove(i); + break; + } + } + } this.mAdapter.notifyDataSetChanged(); } @@ -874,22 +885,22 @@ public class NavigationView extends RelativeLayout implements //Load the data loadData(sortedFiles); - NavigationView.this.mFiles = sortedFiles; + this.mFiles = sortedFiles; if (searchInfo != null) { searchInfo.setSuccessNavigation(true); } //Add to history? if (addToHistory && hasChanged && isNewHistory) { - if (NavigationView.this.mOnHistoryListener != null) { + if (this.mOnHistoryListener != null) { //Communicate the need of a history change - NavigationView.this.mOnHistoryListener.onNewHistory(onSaveState()); + this.mOnHistoryListener.onNewHistory(onSaveState()); } } //Change the breadcrumb - if (NavigationView.this.mBreadcrumb != null) { - NavigationView.this.mBreadcrumb.changeBreadcrumbPath(newDir, this.mChRooted); + if (this.mBreadcrumb != null) { + this.mBreadcrumb.changeBreadcrumbPath(newDir, this.mChRooted); } //Scroll to object? @@ -898,12 +909,12 @@ public class NavigationView extends RelativeLayout implements } //The current directory is now the "newDir" - NavigationView.this.mCurrentDir = newDir; + this.mCurrentDir = newDir; } finally { //If calling activity is search, then save the search history if (searchInfo != null) { - NavigationView.this.mOnHistoryListener.onNewHistory(searchInfo); + this.mOnHistoryListener.onNewHistory(searchInfo); } //End of loading data