From: David A. Velasco Date: Mon, 15 Oct 2012 10:57:14 +0000 (+0200) Subject: Fixed problem in first-ever synchronization introduced while refactoring list adapters X-Git-Tag: oc-android-1.4.3~153 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/c7a2866454c478258cbd29d65dfff83ce2c9c60a Fixed problem in first-ever synchronization introduced while refactoring list adapters --- diff --git a/src/com/owncloud/android/ui/adapter/FileListListAdapter.java b/src/com/owncloud/android/ui/adapter/FileListListAdapter.java index e8ff4cd7..49fa7a0c 100644 --- a/src/com/owncloud/android/ui/adapter/FileListListAdapter.java +++ b/src/com/owncloud/android/ui/adapter/FileListListAdapter.java @@ -61,7 +61,7 @@ public class FileListListAdapter extends BaseAdapter implements ListAdapter { mContext = context; mAccount = AccountUtils.getCurrentOwnCloudAccount(mContext); mTransferServiceGetter = transferServiceGetter; - swapDirectory(file); + swapDirectory(file, mStorageManager); /*mFile = file; mFiles = mStorageManager.getDirectoryContent(mFile);*/ } @@ -195,10 +195,15 @@ public class FileListListAdapter extends BaseAdapter implements ListAdapter { /** * Change the adapted directory for a new one - * @param directory New file to adapt. Can be NULL, meaning "no content to adapt". + * @param directory New file to adapt. Can be NULL, meaning "no content to adapt". + * @param updatedStorageManager Optional updated storage manager; used to replace mStorageManager if is different (and not NULL) */ - public void swapDirectory(OCFile directory) { + public void swapDirectory(OCFile directory, DataStorageManager updatedStorageManager) { mFile = directory; + if (updatedStorageManager != null && updatedStorageManager != mStorageManager) { + mStorageManager = updatedStorageManager; + mAccount = AccountUtils.getCurrentOwnCloudAccount(mContext); + } if (mStorageManager != null) { mFiles = mStorageManager.getDirectoryContent(mFile); } else { diff --git a/src/com/owncloud/android/ui/fragment/OCFileListFragment.java b/src/com/owncloud/android/ui/fragment/OCFileListFragment.java index 4f6e66bd..60ded05f 100644 --- a/src/com/owncloud/android/ui/fragment/OCFileListFragment.java +++ b/src/com/owncloud/android/ui/fragment/OCFileListFragment.java @@ -192,7 +192,7 @@ public class OCFileListFragment extends FragmentListView { } mFile = directory; - mAdapter.swapDirectory(mFile); + mAdapter.swapDirectory(mFile, storageManager); mList.setSelectionFromTop(0, 0); mList.invalidate(); }