From: masensio Date: Mon, 25 May 2015 22:01:39 +0000 (+0200) Subject: Disable On Device option in Navigation Drawer X-Git-Tag: oc-android-1.7.2~1^2~23^2~38^2~5 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/015eb6fee99b59abab2f70bb67cf7b6cda191620?ds=inline;hp=-c Disable On Device option in Navigation Drawer --- 015eb6fee99b59abab2f70bb67cf7b6cda191620 diff --git a/res/values/strings.xml b/res/values/strings.xml index b9aeea49..d17fdb50 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -23,7 +23,7 @@ Accounts All Files - On device + Settings ownCloud diff --git a/src/com/owncloud/android/MainApp.java b/src/com/owncloud/android/MainApp.java index 0d725e5a..c805f9f7 100644 --- a/src/com/owncloud/android/MainApp.java +++ b/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() { diff --git a/src/com/owncloud/android/datamodel/FileDataStorageManager.java b/src/com/owncloud/android/datamodel/FileDataStorageManager.java index 42f2c780..7db0a637 100644 --- a/src/com/owncloud/android/datamodel/FileDataStorageManager.java +++ b/src/com/owncloud/android/datamodel/FileDataStorageManager.java @@ -142,9 +142,10 @@ public class FileDataStorageManager { } - public Vector getFolderContent(OCFile f, boolean onlyOnDevice) { + public Vector 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(); @@ -152,11 +153,12 @@ public class FileDataStorageManager { } - public Vector getFolderImages(OCFile folder, boolean onlyOnDevice) { + public Vector getFolderImages(OCFile folder/*, boolean onlyOnDevice*/) { Vector ret = new Vector(); if (folder != null) { - // TODO better implementation, filtering in the access to database instead of here - Vector tmp = getFolderContent(folder, onlyOnDevice); + // TODO better implementation, filtering in the access to database instead of here + // TODO Enable when "On Device" is recovered ? + Vector tmp = getFolderContent(folder/*, onlyOnDevice*/); OCFile current = null; for (int i=0; i files = getFolderContent(folder.getFileId(), false); + // TODO Enable when "On Device" is recovered ? + Vector files = getFolderContent(folder.getFileId()/*, false*/); if (files != null) { for (OCFile file : files) { if (file.isFolder()) { @@ -731,7 +734,7 @@ public class FileDataStorageManager { } - private Vector getFolderContent(long parentId, boolean onlyOnDevice) { + private Vector getFolderContent(long parentId/*, boolean onlyOnDevice*/) { Vector ret = new Vector(); @@ -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 files = getFolderContent(folder, false); + + // TODO Enable when "On Device" is recovered ? + Vector files = getFolderContent(folder /*, false*/); for (OCFile file : files) { whereArgs[0] = file.getRemotePath(); diff --git a/src/com/owncloud/android/operations/RefreshFolderOperation.java b/src/com/owncloud/android/operations/RefreshFolderOperation.java index 5a1cf856..2e3c4692 100644 --- a/src/com/owncloud/android/operations/RefreshFolderOperation.java +++ b/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 filesToSyncContents = new Vector(); // get current data about local contents of the folder to synchronize - List localFiles = mStorageManager.getFolderContent(mLocalFolder, false); + // TODO Enable when "On Device" is recovered ? + List localFiles = mStorageManager.getFolderContent(mLocalFolder/*, false*/); Map localFilesMap = new HashMap(localFiles.size()); for (OCFile file : localFiles) { localFilesMap.put(file.getRemotePath(), file); diff --git a/src/com/owncloud/android/operations/SynchronizeFolderOperation.java b/src/com/owncloud/android/operations/SynchronizeFolderOperation.java index d4423d11..6bf1ef82 100644 --- a/src/com/owncloud/android/operations/SynchronizeFolderOperation.java +++ b/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 localFiles = storageManager.getFolderContent(mLocalFolder, false); + // TODO Enable when "On Device" is recovered ? + List localFiles = storageManager.getFolderContent(mLocalFolder/*, false*/); Map localFilesMap = new HashMap(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 children = getStorageManager().getFolderContent(mLocalFolder, false); + // TODO Enable when "On Device" is recovered ? + List children = getStorageManager().getFolderContent(mLocalFolder/*, false*/); for (OCFile child : children) { /// classify file to sync/download contents later if (child.isFolder()) { diff --git a/src/com/owncloud/android/ui/activity/FileDisplayActivity.java b/src/com/owncloud/android/ui/activity/FileDisplayActivity.java index b820e13f..a15f9c1d 100644 --- a/src/com/owncloud/android/ui/activity/FileDisplayActivity.java +++ b/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) { diff --git a/src/com/owncloud/android/ui/activity/FolderPickerActivity.java b/src/com/owncloud/android/ui/activity/FolderPickerActivity.java index 6dec67d2..eec8ab3a 100644 --- a/src/com/owncloud/android/ui/activity/FolderPickerActivity.java +++ b/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); diff --git a/src/com/owncloud/android/ui/activity/UploadPathActivity.java b/src/com/owncloud/android/ui/activity/UploadPathActivity.java index a4e9cb73..db704d14 100644 --- a/src/com/owncloud/android/ui/activity/UploadPathActivity.java +++ b/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); } diff --git a/src/com/owncloud/android/ui/activity/Uploader.java b/src/com/owncloud/android/ui/activity/Uploader.java index 7336af96..67236162 100644 --- a/src/com/owncloud/android/ui/activity/Uploader.java +++ b/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 tmpfiles = getStorageManager().getFolderContent(mFile, false); + // TODO Enable when "On Device" is recovered ? + Vector tmpfiles = getStorageManager().getFolderContent(mFile /*, false*/); if (tmpfiles.size() <= 0) return; // filter on dirtype Vector files = new Vector(); @@ -417,7 +418,8 @@ public class Uploader extends FileActivity mFile = getStorageManager().getFileByPath(full_path); if (mFile != null) { - Vector files = getStorageManager().getFolderContent(mFile, false); + // TODO Enable when "On Device" is recovered ? + Vector files = getStorageManager().getFolderContent(mFile/*, false*/); List> data = new LinkedList>(); for (OCFile f : files) { HashMap h = new HashMap(); diff --git a/src/com/owncloud/android/ui/adapter/FileListListAdapter.java b/src/com/owncloud/android/ui/adapter/FileListListAdapter.java index 43c30834..c6ea0344 100644 --- a/src/com/owncloud/android/ui/adapter/FileListListAdapter.java +++ b/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); diff --git a/src/com/owncloud/android/ui/dialog/RemoveFileDialogFragment.java b/src/com/owncloud/android/ui/dialog/RemoveFileDialogFragment.java index 179ab962..f00b19f1 100644 --- a/src/com/owncloud/android/ui/dialog/RemoveFileDialogFragment.java +++ b/src/com/owncloud/android/ui/dialog/RemoveFileDialogFragment.java @@ -112,7 +112,8 @@ implements ConfirmationDialogFragmentListener { boolean containsKeepInSync = false; if (mTargetFile.isFolder()) { - Vector files = storageManager.getFolderContent(mTargetFile, false); + // TODO Enable when "On Device" is recovered ? + Vector files = storageManager.getFolderContent(mTargetFile/*, false*/); for(OCFile file: files) { containsKeepInSync = file.keepInSync() || containsKeepInSync; diff --git a/src/com/owncloud/android/ui/fragment/OCFileListFragment.java b/src/com/owncloud/android/ui/fragment/OCFileListFragment.java index 9430f112..4bf68ad0 100644 --- a/src/com/owncloud/android/ui/fragment/OCFileListFragment.java +++ b/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); } diff --git a/src/com/owncloud/android/ui/preview/PreviewImageActivity.java b/src/com/owncloud/android/ui/preview/PreviewImageActivity.java index 3af7992b..6ff3cb8f 100644 --- a/src/com/owncloud/android/ui/preview/PreviewImageActivity.java +++ b/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; diff --git a/src/com/owncloud/android/ui/preview/PreviewImagePagerAdapter.java b/src/com/owncloud/android/ui/preview/PreviewImagePagerAdapter.java index fc99d289..dda7dda2 100644 --- a/src/com/owncloud/android/ui/preview/PreviewImagePagerAdapter.java +++ b/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);