Browse Source

Merge remote-tracking branch 'upstream/develop' into navigationDrawer_update

# Conflicts:
#	gradle/wrapper/gradle-wrapper.properties
#	owncloud-android-library
#	res/layout-land/account_setup.xml
#	res/layout/account_setup.xml
#	res/layout/list_item.xml
#	res/layout/uploader_list_item_layout.xml
#	res/menu/main_menu.xml
#	res/values/colors.xml
#	res/values/strings.xml
#	src/com/owncloud/android/MainApp.java
#	src/com/owncloud/android/operations/SynchronizeFolderOperation.java
#	src/com/owncloud/android/ui/activity/FileDisplayActivity.java
#	src/com/owncloud/android/ui/activity/Preferences.java
#	src/com/owncloud/android/ui/activity/Uploader.java
#	src/com/owncloud/android/ui/adapter/FileListListAdapter.java
#	src/com/owncloud/android/ui/adapter/LocalFileListAdapter.java
#	src/com/owncloud/android/ui/fragment/OCFileListFragment.java
#	src/com/owncloud/android/ui/preview/PreviewImagePagerAdapter.java
#	src/com/owncloud/android/utils/BitmapUtils.java
tobiasKaminsky 9 years ago
parent
commit
293d636f3a

+ 1 - 1
src/com/owncloud/android/operations/RefreshFolderOperation.java

@@ -341,7 +341,7 @@ public class RefreshFolderOperation extends RemoteOperation {
         List<SynchronizeFileOperation> filesToSyncContents = new Vector<SynchronizeFileOperation>();
 
         // get current data about local contents of the folder to synchronize
-        List<OCFile> localFiles = mStorageManager.getFolderContent(mLocalFolder, true);
+        List<OCFile> localFiles = mStorageManager.getFolderContent(mLocalFolder, false);
         Map<String, OCFile> localFilesMap = new HashMap<String, OCFile>(localFiles.size());
         for (OCFile file : localFiles) {
             localFilesMap.put(file.getRemotePath(), file);

+ 2 - 2
src/com/owncloud/android/operations/SynchronizeFolderOperation.java

@@ -316,7 +316,7 @@ public class SynchronizeFolderOperation extends SyncOperation {
         }
 
         // get current data about local contents of the folder to synchronize
-        List<OCFile> localFiles = storageManager.getFolderContent(mLocalFolder, true);
+        List<OCFile> localFiles = storageManager.getFolderContent(mLocalFolder, false);
         Map<String, OCFile> localFilesMap = new HashMap<String, OCFile>(localFiles.size());
         for (OCFile file : localFiles) {
             localFilesMap.put(file.getRemotePath(), file);
@@ -412,7 +412,7 @@ public class SynchronizeFolderOperation extends SyncOperation {
     
     private void prepareOpsFromLocalKnowledge() throws OperationCancelledException {
         // TODO TOBI ist das richtig?
-        List<OCFile> children = getStorageManager().getFolderContent(mLocalFolder, true);
+        List<OCFile> children = getStorageManager().getFolderContent(mLocalFolder, false);
         for (OCFile child : children) {
             /// classify file to sync/download contents later
             if (child.isFolder()) {

+ 10 - 3
src/com/owncloud/android/ui/activity/FileDisplayActivity.java

@@ -164,6 +164,7 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
     private static String DIALOG_UPLOAD_SOURCE = "DIALOG_UPLOAD_SOURCE";
     private static String DIALOG_CERT_NOT_SAVED = "DIALOG_CERT_NOT_SAVED";
 
+    private NavigationDrawerListAdapter adapter = null;
 
     private OCFile mWaitingToSend;
     
@@ -237,7 +238,7 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
         
         // ListView
         ListView listView = (ListView) notificatonDrawer.findViewById(R.id.drawer_list);
-        final NavigationDrawerListAdapter adapter = new NavigationDrawerListAdapter(getApplicationContext(), this);
+        adapter = new NavigationDrawerListAdapter(getApplicationContext(), this);
         
         listView.setAdapter(adapter);
         
@@ -276,8 +277,11 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
         // Username
         TextView username = (TextView) notificatonDrawer.findViewById(R.id.drawer_username);
         Account account = AccountUtils.getCurrentOwnCloudAccount(getApplicationContext());
-        int lastAtPos = account.name.lastIndexOf("@");
-        username.setText(account.name.substring(0, lastAtPos));
+
+        if (account != null) {
+            int lastAtPos = account.name.lastIndexOf("@");
+            username.setText(account.name.substring(0, lastAtPos));
+        }
 
         // Set the drawer toggle as the DrawerListener
         mDrawerLayout.setDrawerListener(mDrawerToggle);
@@ -890,6 +894,9 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
         Log_OC.v(TAG, "onResume() start");
         super.onResume();
 
+        // refresh Navigation Drawer account list
+        adapter.updateAccountList();
+
         // refresh list of files
         refreshListOfFilesFragment();
 

+ 1 - 1
src/com/owncloud/android/ui/adapter/FileListListAdapter.java

@@ -414,7 +414,7 @@ public class FileListListAdapter extends BaseAdapter implements ListAdapter {
             mAccount = AccountUtils.getCurrentOwnCloudAccount(mContext);
         }
         if (mStorageManager != null) {
-            mFiles = mStorageManager.getFolderContent(mFile, false);
+            mFiles = mStorageManager.getFolderContent(mFile, onlyOnDevice);
             mFilesOrig.clear();
             mFilesOrig.addAll(mFiles);
             

+ 7 - 2
src/com/owncloud/android/ui/adapter/NavigationDrawerListAdapter.java

@@ -44,11 +44,15 @@ public class NavigationDrawerListAdapter extends BaseAdapter {
             mDrawerItems.add(string);
         }
 
+        updateAccountList();
+
+        all.addAll(mDrawerItems);
+    }
+
+    public void updateAccountList(){
         AccountManager am = (AccountManager) mContext.getSystemService(mContext.ACCOUNT_SERVICE);
         mAccounts = am.getAccountsByType(MainApp.getAccountType());
         currentAccount = AccountUtils.getCurrentOwnCloudAccount(mContext);
-
-        all.addAll(mDrawerItems);
     }
 
     @Override
@@ -157,6 +161,7 @@ public class NavigationDrawerListAdapter extends BaseAdapter {
         return convertView;
     }
 
+    // TODO update Account List after creating a new account and on fresh installation
     public void setShowAccounts(boolean value){
         all.clear();
         all.addAll(mDrawerItems);