浏览代码

Disable On Device option in Navigation Drawer

masensio 9 年之前
父节点
当前提交
015eb6fee9

+ 1 - 1
res/values/strings.xml

@@ -23,7 +23,7 @@
     <string-array name="drawer_items">
         <item>Accounts</item>
 	    <item>All Files</item>
-	    <item>On device</item>
+	    <!--<item>On device</item>-->
 	    <item>Settings</item>
     </string-array>
     <string name="drawer_open">ownCloud</string>

+ 12 - 10
src/com/owncloud/android/MainApp.java

@@ -53,9 +53,10 @@ public class MainApp extends Application {
     private static final String POLICY_ALWAYS_NEW_CLIENT = "always new client";
 
     private static Context mContext;
-    
+
+    // TODO Enable when "On Device" is recovered?
     // TODO better place
-    private static boolean mOnlyOnDevice = false;
+    // private static boolean mOnlyOnDevice = false;
 
     
     public void onCreate(){
@@ -174,14 +175,15 @@ public class MainApp extends Application {
     public static String getLogName() {
         return getAppContext().getResources().getString(R.string.log_name);
     }
-    
-    public static void showOnlyFilesOnDevice(boolean state){
-        mOnlyOnDevice = state;
-    }
-    
-    public static boolean getOnlyOnDevice(){
-        return mOnlyOnDevice;
-    }
+
+    // TODO Enable when "On Device" is recovered ?
+//    public static void showOnlyFilesOnDevice(boolean state){
+//        mOnlyOnDevice = state;
+//    }
+//
+//    public static boolean getOnlyOnDevice(){
+//        return mOnlyOnDevice;
+//    }
 
     // user agent
     public static String getUserAgent() {

+ 16 - 11
src/com/owncloud/android/datamodel/FileDataStorageManager.java

@@ -142,9 +142,10 @@ public class FileDataStorageManager {
     }
 
     
-    public Vector<OCFile> getFolderContent(OCFile f, boolean onlyOnDevice) {
+    public Vector<OCFile> getFolderContent(OCFile f/*, boolean onlyOnDevice*/) {
         if (f != null && f.isFolder() && f.getFileId() != -1) {
-            return getFolderContent(f.getFileId(), onlyOnDevice);
+            // TODO Enable when "On Device" is recovered ?
+            return getFolderContent(f.getFileId()/*, onlyOnDevice*/);
 
         } else {
             return new Vector<OCFile>();
@@ -152,11 +153,12 @@ public class FileDataStorageManager {
     }
     
     
-    public Vector<OCFile> getFolderImages(OCFile folder, boolean onlyOnDevice) {
+    public Vector<OCFile> getFolderImages(OCFile folder/*, boolean onlyOnDevice*/) {
         Vector<OCFile> ret = new Vector<OCFile>(); 
         if (folder != null) {
-            // TODO better implementation, filtering in the access to database instead of here 
-            Vector<OCFile> tmp = getFolderContent(folder, onlyOnDevice);
+            // TODO better implementation, filtering in the access to database instead of here
+            // TODO Enable when "On Device" is recovered ?
+            Vector<OCFile> tmp = getFolderContent(folder/*, onlyOnDevice*/);
             OCFile current = null; 
             for (int i=0; i<tmp.size(); i++) {
                 current = tmp.get(i);
@@ -547,7 +549,8 @@ public class FileDataStorageManager {
         File localFolder = new File(localFolderPath);
         if (localFolder.exists()) {
             // stage 1: remove the local files already registered in the files database
-            Vector<OCFile> files = getFolderContent(folder.getFileId(), false);
+            // TODO Enable when "On Device" is recovered ?
+            Vector<OCFile> files = getFolderContent(folder.getFileId()/*, false*/);
             if (files != null) {
                 for (OCFile file : files) {
                     if (file.isFolder()) {
@@ -731,7 +734,7 @@ public class FileDataStorageManager {
     }
     
     
-    private Vector<OCFile> getFolderContent(long parentId, boolean onlyOnDevice) {
+    private Vector<OCFile> getFolderContent(long parentId/*, boolean onlyOnDevice*/) {
 
         Vector<OCFile> ret = new Vector<OCFile>();
 
@@ -758,9 +761,10 @@ public class FileDataStorageManager {
         if (c.moveToFirst()) {
             do {
                 OCFile child = createFileInstance(c);
-                if (child.isFolder() || !onlyOnDevice || onlyOnDevice && child.isDown()){
+                // TODO Enable when "On Device" is recovered ?
+                // if (child.isFolder() || !onlyOnDevice || onlyOnDevice && child.isDown()){
                     ret.add(child);
-                }
+                // }
             } while (c.moveToNext());
         }
 
@@ -1442,8 +1446,9 @@ public class FileDataStorageManager {
             String where = ProviderTableMeta.OCSHARES_PATH + "=?" + " AND " 
                     + ProviderTableMeta.OCSHARES_ACCOUNT_OWNER + "=?";
             String [] whereArgs = new String[]{ "", mAccount.name };
-            
-            Vector<OCFile> files = getFolderContent(folder, false);
+
+            // TODO Enable when "On Device" is recovered ?
+            Vector<OCFile> files = getFolderContent(folder /*, false*/);
             
             for (OCFile file : files) {
                 whereArgs[0] = file.getRemotePath();

+ 4 - 2
src/com/owncloud/android/operations/RefreshFolderOperation.java

@@ -201,7 +201,8 @@ public class RefreshFolderOperation extends RemoteOperation {
             if (mRemoteFolderChanged) {
                 result = fetchAndSyncRemoteFolder(client);
             } else {
-                mChildren = mStorageManager.getFolderContent(mLocalFolder, false);
+                // TODO Enable when "On Device" is recovered ?
+                mChildren = mStorageManager.getFolderContent(mLocalFolder/*, false*/);
             }
         }
         
@@ -341,7 +342,8 @@ 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, false);
+        // TODO Enable when "On Device" is recovered ?
+        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);

+ 5 - 22
src/com/owncloud/android/operations/SynchronizeFolderOperation.java

@@ -21,51 +21,33 @@
 package com.owncloud.android.operations;
 
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Vector;
 
-import org.apache.http.HttpStatus;
-
 import android.accounts.Account;
 import android.content.Context;
 import android.content.Intent;
 import android.util.Log;
 
-import com.owncloud.android.MainApp;
+
 import com.owncloud.android.datamodel.FileDataStorageManager;
 import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.files.services.FileDownloader;
 import com.owncloud.android.lib.common.OwnCloudClient;
 import com.owncloud.android.lib.common.operations.OperationCancelledException;
-import com.owncloud.android.lib.common.operations.RemoteOperation;
 import com.owncloud.android.lib.common.operations.RemoteOperationResult;
 import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
 import com.owncloud.android.lib.common.utils.Log_OC;
-import com.owncloud.android.lib.resources.files.FileUtils;
 import com.owncloud.android.lib.resources.files.ReadRemoteFileOperation;
 import com.owncloud.android.lib.resources.files.ReadRemoteFolderOperation;
 import com.owncloud.android.lib.resources.files.RemoteFile;
-import com.owncloud.android.lib.resources.shares.GetRemoteSharesForFileOperation;
-import com.owncloud.android.lib.resources.shares.OCShare;
-import com.owncloud.android.syncadapter.FileSyncAdapter;
 import com.owncloud.android.operations.common.SyncOperation;
 import com.owncloud.android.services.OperationsService;
 import com.owncloud.android.utils.FileStorageUtils;
 
-import java.io.File;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Vector;
 import java.util.concurrent.atomic.AtomicBoolean;
 
 //import android.support.v4.content.LocalBroadcastManager;
@@ -316,7 +298,8 @@ public class SynchronizeFolderOperation extends SyncOperation {
         }
 
         // get current data about local contents of the folder to synchronize
-        List<OCFile> localFiles = storageManager.getFolderContent(mLocalFolder, false);
+        // TODO Enable when "On Device" is recovered ?
+        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);
@@ -411,8 +394,8 @@ public class SynchronizeFolderOperation extends SyncOperation {
     
     
     private void prepareOpsFromLocalKnowledge() throws OperationCancelledException {
-        // TODO TOBI ist das richtig?
-        List<OCFile> children = getStorageManager().getFolderContent(mLocalFolder, false);
+        // TODO Enable when "On Device" is recovered ?
+        List<OCFile> children = getStorageManager().getFolderContent(mLocalFolder/*, false*/);
         for (OCFile child : children) {
             /// classify file to sync/download contents later
             if (child.isFolder()) {

+ 26 - 12
src/com/owncloud/android/ui/activity/FileDisplayActivity.java

@@ -255,14 +255,16 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
                     adapter.notifyDataSetChanged();
                     break;
                 case 1:
-                    MainApp.showOnlyFilesOnDevice(false);
+                    // TODO Enable when "On Device" is recovered ?
+                    //MainApp.showOnlyFilesOnDevice(false);
                     mDrawerLayout.closeDrawers();
                     break;
+                // TODO Enable when "On Device" is recovered ?
+//                case 2:
+//                    MainApp.showOnlyFilesOnDevice(true);
+//                    mDrawerLayout.closeDrawers();
+//                    break;
                 case 2:
-                    MainApp.showOnlyFilesOnDevice(true);
-                    mDrawerLayout.closeDrawers();
-                    break;
-                case 3:
                     Intent settingsIntent = new Intent(getApplicationContext(), Preferences.class);
                     startActivity(settingsIntent);
                     break;
@@ -408,7 +410,9 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
             /// First fragment
             OCFileListFragment listOfFiles = getListOfFilesFragment(); 
             if (listOfFiles != null) {
-                listOfFiles.listDirectory(getCurrentDir(), MainApp.getOnlyOnDevice());   
+                listOfFiles.listDirectory(getCurrentDir());
+                // TODO Enable when "On Device" is recovered
+                // listOfFiles.listDirectory(getCurrentDir(), MainApp.getOnlyOnDevice());
             } else {
                 Log_OC.e(TAG, "Still have a chance to lose the initializacion of list fragment >(");
             }
@@ -527,8 +531,10 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
 
     protected void refreshListOfFilesFragment() {
         OCFileListFragment fileListFragment = getListOfFilesFragment();
-        if (fileListFragment != null) { 
-            fileListFragment.listDirectory(MainApp.getOnlyOnDevice());
+        if (fileListFragment != null) {
+            fileListFragment.listDirectory();
+            // TODO Enable when "On Device" is recovered ?
+            // fileListFragment.listDirectory(MainApp.getOnlyOnDevice());
         }
     }
 
@@ -1046,7 +1052,9 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
                             if (synchFolderRemotePath != null && currentDir.getRemotePath().equals(synchFolderRemotePath)) {
                                 OCFileListFragment fileListFragment = getListOfFilesFragment();
                                 if (fileListFragment != null) {
-                                    fileListFragment.listDirectory(currentDir, MainApp.getOnlyOnDevice());
+                                    fileListFragment.listDirectory();
+                                    // TODO Enable when "On Device" is recovered ?
+                                    // fileListFragment.listDirectory(currentDir, MainApp.getOnlyOnDevice());
                                 }
                             }
                             setFile(currentFile);
@@ -1275,7 +1283,9 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
                 popDirname();
             }
             OCFile root = getStorageManager().getFileByPath(OCFile.ROOT_PATH);
-            listOfFiles.listDirectory(root, MainApp.getOnlyOnDevice());
+            listOfFiles.listDirectory(root);
+            // TODO Enable when "On Device" is recovered ?
+            // listOfFiles.listDirectory(root, MainApp.getOnlyOnDevice());
             setFile(listOfFiles.getCurrentFile());
             startSyncFolderOperation(root, false);
         }
@@ -1290,7 +1300,9 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
         OCFileListFragment listOfFiles = getListOfFilesFragment(); 
         if (listOfFiles != null) {
             setNavigationListWithFolder(folder);
-            listOfFiles.listDirectory(folder, MainApp.getOnlyOnDevice());
+            listOfFiles.listDirectory(folder);
+            // TODO Enable when "On Device" is recovered ?
+            // listOfFiles.listDirectory(folder, MainApp.getOnlyOnDevice());
             setFile(listOfFiles.getCurrentFile());
             startSyncFolderOperation(folder, false);
         } else {
@@ -1402,7 +1414,9 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
             // a new chance to get the mDownloadBinder through getFileDownloadBinder() - THIS IS A MESS
             OCFileListFragment listOfFiles = getListOfFilesFragment(); 
             if (listOfFiles != null) {
-                listOfFiles.listDirectory(MainApp.getOnlyOnDevice());
+                listOfFiles.listDirectory();
+                // TODO Enable when "On Device" is recovered ?
+                // listOfFiles.listDirectory(MainApp.getOnlyOnDevice());
             }
             FileFragment secondFragment = getSecondFragment();
             if (secondFragment != null && secondFragment instanceof FileDetailFragment) {

+ 11 - 5
src/com/owncloud/android/ui/activity/FolderPickerActivity.java

@@ -142,7 +142,7 @@ public class FolderPickerActivity extends FileActivity implements FileFragment.C
             
             if (!stateWasRecovered) {
                 OCFileListFragment listOfFolders = getListOfFilesFragment(); 
-                listOfFolders.listDirectory(folder, false);   
+                listOfFolders.listDirectory(folder/*, false*/);
                 
                 startSyncFolderOperation(folder, false);
             }
@@ -310,8 +310,10 @@ public class FolderPickerActivity extends FileActivity implements FileFragment.C
     
     protected void refreshListOfFilesFragment() {
         OCFileListFragment fileListFragment = getListOfFilesFragment();
-        if (fileListFragment != null) { 
-            fileListFragment.listDirectory(false);
+        if (fileListFragment != null) {
+            fileListFragment.listDirectory();
+            // TODO Enable when "On Device" is recovered ?
+            // fileListFragment.listDirectory(false);
         }
     }
 
@@ -319,7 +321,9 @@ public class FolderPickerActivity extends FileActivity implements FileFragment.C
         OCFileListFragment listOfFiles = getListOfFilesFragment(); 
         if (listOfFiles != null) {  // should never be null, indeed
             OCFile root = getStorageManager().getFileByPath(OCFile.ROOT_PATH);
-            listOfFiles.listDirectory(root, false);
+            listOfFiles.listDirectory(root);
+            // TODO Enable when "On Device" is recovered ?
+            // listOfFiles.listDirectory(root, false);
             setFile(listOfFiles.getCurrentFile());
             updateNavigationElementsInActionBar();
             startSyncFolderOperation(root, false);
@@ -471,7 +475,9 @@ public class FolderPickerActivity extends FileActivity implements FileFragment.C
                                     equals(synchFolderRemotePath)) {
                                 OCFileListFragment fileListFragment = getListOfFilesFragment();
                                 if (fileListFragment != null) {
-                                    fileListFragment.listDirectory(currentDir, false);
+                                    fileListFragment.listDirectory(currentDir);
+                                    // TODO Enable when "On Device" is recovered ?
+                                    // fileListFragment.listDirectory(currentDir, false);
                                 }
                             }
                             setFile(currentFile);

+ 2 - 1
src/com/owncloud/android/ui/activity/UploadPathActivity.java

@@ -67,7 +67,8 @@ public class UploadPathActivity extends FolderPickerActivity implements FileFrag
 
             if (!stateWasRecovered) {
                 OCFileListFragment listOfFolders = getListOfFilesFragment();
-                listOfFolders.listDirectory(folder, false);
+                // TODO Enable when "On Device" is recovered ?
+                listOfFolders.listDirectory(folder/*, false*/);
 
                 startSyncFolderOperation(folder, false);
             }

+ 4 - 2
src/com/owncloud/android/ui/activity/Uploader.java

@@ -332,7 +332,8 @@ public class Uploader extends FileActivity
     public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
         // click on folder in the list
         Log_OC.d(TAG, "on item click");
-        Vector<OCFile> tmpfiles = getStorageManager().getFolderContent(mFile, false);
+        // TODO Enable when "On Device" is recovered ?
+        Vector<OCFile> tmpfiles = getStorageManager().getFolderContent(mFile /*, false*/);
         if (tmpfiles.size() <= 0) return;
         // filter on dirtype
         Vector<OCFile> files = new Vector<OCFile>();
@@ -417,7 +418,8 @@ public class Uploader extends FileActivity
 
         mFile = getStorageManager().getFileByPath(full_path);
         if (mFile != null) {
-            Vector<OCFile> files = getStorageManager().getFolderContent(mFile, false);
+            // TODO Enable when "On Device" is recovered ?
+            Vector<OCFile> files = getStorageManager().getFolderContent(mFile/*, false*/);
             List<HashMap<String, Object>> data = new LinkedList<HashMap<String,Object>>();
             for (OCFile f : files) {
                 HashMap<String, Object> h = new HashMap<String, Object>();

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

@@ -407,14 +407,16 @@ public class FileListListAdapter extends BaseAdapter implements ListAdapter {
      * @param updatedStorageManager     Optional updated storage manager; used to replace 
      *                                  mStorageManager if is different (and not NULL)
      */
-    public void swapDirectory(OCFile directory, FileDataStorageManager updatedStorageManager, boolean onlyOnDevice) {
+    public void swapDirectory(OCFile directory, FileDataStorageManager updatedStorageManager
+            /*, boolean onlyOnDevice*/) {
         mFile = directory;
         if (updatedStorageManager != null && updatedStorageManager != mStorageManager) {
             mStorageManager = updatedStorageManager;
             mAccount = AccountUtils.getCurrentOwnCloudAccount(mContext);
         }
         if (mStorageManager != null) {
-            mFiles = mStorageManager.getFolderContent(mFile, onlyOnDevice);
+            // TODO Enable when "On Device" is recovered ?
+            mFiles = mStorageManager.getFolderContent(mFile/*, onlyOnDevice*/);
             mFilesOrig.clear();
             mFilesOrig.addAll(mFiles);
             

+ 2 - 1
src/com/owncloud/android/ui/dialog/RemoveFileDialogFragment.java

@@ -112,7 +112,8 @@ implements ConfirmationDialogFragmentListener {
         
         boolean containsKeepInSync = false;
         if (mTargetFile.isFolder()) {
-            Vector<OCFile> files = storageManager.getFolderContent(mTargetFile, false);
+            // TODO Enable when "On Device" is recovered ?
+            Vector<OCFile> files = storageManager.getFolderContent(mTargetFile/*, false*/);
             for(OCFile file: files) {
                 containsKeepInSync = file.keepInSync() || containsKeepInSync;
 

+ 14 - 11
src/com/owncloud/android/ui/fragment/OCFileListFragment.java

@@ -29,15 +29,12 @@ import android.content.Intent;
 import android.os.Bundle;
 import android.support.v4.widget.SwipeRefreshLayout;
 import android.view.ContextMenu;
-import android.view.LayoutInflater;
 import android.view.MenuInflater;
 import android.view.MenuItem;
 import android.view.View;
 import android.widget.AdapterView;
 import android.widget.AdapterView.AdapterContextMenuInfo;
-import android.widget.TextView;
 
-import com.owncloud.android.MainApp;
 import com.owncloud.android.R;
 import com.owncloud.android.datamodel.FileDataStorageManager;
 import com.owncloud.android.datamodel.OCFile;
@@ -186,8 +183,9 @@ public class OCFileListFragment extends ExtendedListFragment {
                 moveCount++;
             }   // exit is granted because storageManager.getFileByPath("/") never returns null
             mFile = parentDir;
-            
-            listDirectory(mFile, MainApp.getOnlyOnDevice());
+
+            // TODO Enable when "On Device" is recovered ?
+            listDirectory(mFile /*, MainApp.getOnlyOnDevice()*/);
 
             onRefresh(false);
             
@@ -205,7 +203,8 @@ public class OCFileListFragment extends ExtendedListFragment {
         if (file != null) {
             if (file.isFolder()) { 
                 // update state and view of this fragment
-                listDirectory(file, MainApp.getOnlyOnDevice());
+                // TODO Enable when "On Device" is recovered ?
+                listDirectory(file/*, MainApp.getOnlyOnDevice()*/);
                 // then, notify parent activity to let it update its state and view
                 mContainerActivity.onBrowsedDownTo(file);
                 // save index and top position
@@ -359,12 +358,15 @@ public class OCFileListFragment extends ExtendedListFragment {
     /**
      * Calls {@link OCFileListFragment#listDirectory(OCFile)} with a null parameter
      */
-    public void listDirectory(boolean onlyOnDevice){
-        listDirectory(null, onlyOnDevice);
+    public void listDirectory(/*boolean onlyOnDevice*/){
+        listDirectory(null);
+        // TODO Enable when "On Device" is recovered ?
+        // listDirectory(null, onlyOnDevice);
     }
     
     public void refreshDirectory(){
-        listDirectory(getCurrentFile(), MainApp.getOnlyOnDevice());
+        // TODO Enable when "On Device" is recovered ?
+        listDirectory(getCurrentFile()/*, MainApp.getOnlyOnDevice()*/);
     }
     
     /**
@@ -374,7 +376,7 @@ public class OCFileListFragment extends ExtendedListFragment {
      * 
      * @param directory File to be listed
      */
-    public void listDirectory(OCFile directory, boolean onlyOnDevice) {
+    public void listDirectory(OCFile directory/*, boolean onlyOnDevice*/) {
         FileDataStorageManager storageManager = mContainerActivity.getStorageManager();
         if (storageManager != null) {
 
@@ -395,7 +397,8 @@ public class OCFileListFragment extends ExtendedListFragment {
                 directory = storageManager.getFileById(directory.getParentId());
             }
 
-            mAdapter.swapDirectory(directory, storageManager, onlyOnDevice);
+            // TODO Enable when "On Device" is recovered ?
+            mAdapter.swapDirectory(directory, storageManager/*, onlyOnDevice*/);
             if (mFile == null || !mFile.equals(directory)) {
                 mCurrentListView.setSelection(0);
             }

+ 3 - 2
src/com/owncloud/android/ui/preview/PreviewImageActivity.java

@@ -38,7 +38,6 @@ import com.actionbarsherlock.app.ActionBar;
 import com.actionbarsherlock.view.MenuItem;
 import com.actionbarsherlock.view.Window;
 import com.ortiz.touch.ExtendedViewPager;
-import com.owncloud.android.MainApp;
 import com.owncloud.android.R;
 import com.owncloud.android.authentication.AccountUtils;
 import com.owncloud.android.datamodel.FileDataStorageManager;
@@ -140,7 +139,9 @@ ViewPager.OnPageChangeListener, OnRemoteOperationListener {
             // should not be necessary
             parentFolder = getStorageManager().getFileByPath(OCFile.ROOT_PATH);
         }
-        mPreviewImagePagerAdapter = new PreviewImagePagerAdapter(getSupportFragmentManager(), parentFolder, getAccount(), getStorageManager(), MainApp.getOnlyOnDevice());
+        // TODO Enable when "On Device" is recovered ?
+        mPreviewImagePagerAdapter = new PreviewImagePagerAdapter(getSupportFragmentManager(),
+                parentFolder, getAccount(), getStorageManager()/*, MainApp.getOnlyOnDevice()*/);
         mViewPager = (ExtendedViewPager) findViewById(R.id.fragmentPager);
         int position = mHasSavedPosition ? mSavedPosition : mPreviewImagePagerAdapter.getFilePosition(getFile());
         position = (position >= 0) ? position : 0;

+ 9 - 7
src/com/owncloud/android/ui/preview/PreviewImagePagerAdapter.java

@@ -19,8 +19,6 @@
  */
 package com.owncloud.android.ui.preview;
 
-import java.util.Collections;
-import java.util.Comparator;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -36,7 +34,6 @@ import android.view.ViewGroup;
 
 import com.owncloud.android.datamodel.FileDataStorageManager;
 import com.owncloud.android.datamodel.OCFile;
-import com.owncloud.android.ui.adapter.FileListListAdapter;
 import com.owncloud.android.ui.fragment.FileFragment;
 import com.owncloud.android.utils.FileStorageUtils;
 
@@ -58,11 +55,14 @@ public class PreviewImagePagerAdapter extends FragmentStatePagerAdapter {
     /**
      * Constructor.
      * 
-     * @param fragmentManager   {@link FragmentManager} instance that will handle the {@link Fragment}s provided by the adapter. 
+     * @param fragmentManager   {@link FragmentManager} instance that will handle
+     *                          the {@link Fragment}s provided by the adapter.
      * @param parentFolder      Folder where images will be searched for.
      * @param storageManager    Bridge to database.
      */
-    public PreviewImagePagerAdapter(FragmentManager fragmentManager, OCFile parentFolder, Account account, FileDataStorageManager storageManager, boolean onlyOnDevice) {
+    public PreviewImagePagerAdapter(FragmentManager fragmentManager, OCFile parentFolder,
+                                    Account account, FileDataStorageManager storageManager /*,
+                                    boolean onlyOnDevice*/) {
         super(fragmentManager);
         
         if (fragmentManager == null) {
@@ -77,7 +77,8 @@ public class PreviewImagePagerAdapter extends FragmentStatePagerAdapter {
 
         mAccount = account;
         mStorageManager = storageManager;
-        mImageFiles = mStorageManager.getFolderImages(parentFolder, false);
+        // TODO Enable when "On Device" is recovered ?
+        mImageFiles = mStorageManager.getFolderImages(parentFolder/*, false*/);
         
         mImageFiles = FileStorageUtils.sortFolder(mImageFiles);
         
@@ -102,7 +103,8 @@ public class PreviewImagePagerAdapter extends FragmentStatePagerAdapter {
         OCFile file = mImageFiles.get(i);
         Fragment fragment = null;
         if (file.isDown()) {
-            fragment = PreviewImageFragment.newInstance(file, mObsoletePositions.contains(Integer.valueOf(i)));
+            fragment = PreviewImageFragment.newInstance(file,
+                    mObsoletePositions.contains(Integer.valueOf(i)));
             
         } else if (mDownloadErrors.contains(Integer.valueOf(i))) {
             fragment = FileDownloadFragment.newInstance(file, mAccount, true);