android:orientation="horizontal" >\r
\r
<ImageView\r
- android:id="@+id/imageView1"\r
+ android:id="@+id/drawer_userIcon"\r
android:layout_width="0dp"\r
android:layout_height="wrap_content"\r
android:layout_weight="1"\r
android:padding="8dp" >\r
\r
<ImageView\r
- android:id="@+id/imageView1"\r
+ android:id="@+id/drawer_userIcon"\r
android:layout_width="match_parent"\r
android:layout_height="wrap_content"\r
android:layout_marginBottom="10dp"\r
--- /dev/null
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+ <RadioGroup xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/drawer_radio_group"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_horizontal"
+ android:orientation="vertical" >
+ </RadioGroup>
\ No newline at end of file
--- /dev/null
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/drawer_textView"
+ android:layout_width="fill_parent"
+ android:layout_height="56dp"
+ android:gravity="center_vertical"
+ android:paddingLeft="16dp"
+ android:paddingRight="16dp"
+ android:textColor="#000"
+ android:textSize="18dp" />
+
--- /dev/null
+<RadioButton xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/drawer_radiobutton"
+ android:layout_width="fill_parent"
+ android:layout_height="56dp"
+ android:gravity="center_vertical"
+ android:paddingLeft="16dp"
+ android:paddingRight="16dp"
+ android:textColor="#000"
+ android:textSize="18dp" />
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>\r
-<!-- \r
+<!--\r
ownCloud Android client application\r
\r
Copyright (C) 2012 Bartek Przybylski\r
\r
You should have received a copy of the GNU General Public License\r
along with this program. If not, see <http://www.gnu.org/licenses/>.\r
- -->\r
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"\r
+ -->\r
+<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"\r
+ android:id="@+id/drawer_layout"\r
android:layout_width="match_parent"\r
android:layout_height="match_parent"\r
- android:background="@color/background_color"\r
- android:orientation="horizontal"\r
- android:baselineAligned="false"\r
- >\r
-\r
- <FrameLayout \r
- android:layout_width="0dp"\r
- android:layout_height="match_parent"\r
- android:layout_weight="1"\r
- android:id="@+id/left_fragment_container"\r
- />\r
- \r
- <FrameLayout \r
- android:layout_width="0dp"\r
- android:layout_height="match_parent"\r
- android:layout_weight="2"\r
- android:id="@+id/right_fragment_container"\r
- />\r
- \r
- </LinearLayout>
\ No newline at end of file
+ android:clickable="true" >\r
+\r
+ <!-- The main content view -->\r
+ <LinearLayout\r
+ xmlns:android="http://schemas.android.com/apk/res/android"\r
+ android:layout_width="match_parent"\r
+ android:layout_height="match_parent"\r
+ android:background="@color/background_color"\r
+ android:baselineAligned="false"\r
+ android:orientation="horizontal" >\r
+\r
+ \r
+ <FrameLayout\r
+ android:id="@+id/left_fragment_container"\r
+ android:layout_width="0dp"\r
+ android:layout_height="match_parent"\r
+ android:layout_weight="1" />\r
+\r
+ <FrameLayout\r
+ android:id="@+id/right_fragment_container"\r
+ android:layout_width="0dp"\r
+ android:layout_height="match_parent"\r
+ android:layout_weight="2" />\r
+ </LinearLayout>\r
+\r
+ \r
+ <LinearLayout\r
+ xmlns:android="http://schemas.android.com/apk/res/android"\r
+ android:id="@+id/left_drawer"\r
+ android:layout_width="240dp"\r
+ android:layout_height="match_parent"\r
+ android:layout_gravity="start"\r
+ android:background="@color/background_color"\r
+ android:baselineAligned="false"\r
+ android:clickable="true"\r
+ android:orientation="vertical">\r
+\r
+ <LinearLayout\r
+ android:layout_width="match_parent"\r
+ android:layout_height="wrap_content"\r
+ android:layout_margin="5dp">\r
+\r
+ <ImageView\r
+ android:id="@+id/drawer_userIcon"\r
+ android:layout_width="40dp"\r
+ android:layout_height="40dp"\r
+ android:src="@drawable/abs__ab_solid_dark_holo" />\r
+\r
+ <TextView\r
+ android:id="@+id/drawer_username"\r
+ android:layout_width="wrap_content"\r
+ android:layout_height="wrap_content"\r
+ android:layout_gravity="center_vertical"\r
+ android:layout_marginLeft="5dp"\r
+ android:layout_marginStart="5dp"\r
+ android:textAppearance="?android:attr/textAppearanceLarge" />\r
+\r
+ </LinearLayout>\r
+\r
+ <TextView\r
+ android:layout_width="fill_parent"\r
+ android:layout_height="2dip"\r
+ android:background="@color/list_item_lastmod_and_filesize_text" />\r
+\r
+ <ListView\r
+ android:id="@+id/drawer_list"\r
+ android:layout_width="fill_parent"\r
+ android:layout_height="match_parent"\r
+ android:background="@color/background_color"\r
+ android:choiceMode="singleChoice"\r
+ />\r
+</LinearLayout>\r
+</android.support.v4.widget.DrawerLayout>
\ No newline at end of file
android:src="@drawable/local_file_indicator" />\r
\r
<ImageView\r
- android:id="@+id/imageView1"\r
+ android:id="@+id/drawer_userIcon"\r
android:layout_width="@dimen/file_icon_size"\r
android:layout_height="@dimen/file_icon_size"\r
android:layout_gravity="center_vertical"\r
--- /dev/null
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="56dp"
+ android:clickable="true"
+ android:orientation="vertical"
+ android:background="#fff"
+ android:paddingLeft="16dp"
+ tools:context=".MainActivity" >
+
+ <TextView
+ android:id="@+id/textView1"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:drawablePadding="5dp"
+ android:gravity="center_vertical"
+ android:paddingLeft="16dp"
+ android:textSize="16dp" >
+
+ </TextView>
+
+ <View
+ android:layout_width="match_parent"
+ android:layout_height="1dp"
+ android:background="@android:color/black" />
+
+</LinearLayout>
\ No newline at end of file
--- /dev/null
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:id="@+id/textView1"
+ android:layout_width="wrap_content"
+ android:background="#fff"
+ android:layout_height="56dp"
+ android:layout_marginLeft="8dp"
+ android:gravity="left"
+ android:paddingLeft="16dp"
+ android:paddingTop="8dp"
+ android:textSize="16dp"
+ android:groupIndicator="@android:color/transparent"
+/>
\ No newline at end of file
android:layout_width="wrap_content" android:background="#fefefe"
android:gravity="center">
<TextView android:layout_width="fill_parent" android:text="@string/uploader_top_message"
- android:layout_height="wrap_content" android:id="@+id/textView1" android:textColor="@android:color/black"
+ android:layout_height="wrap_content" android:id="@+id/drawer_username" android:textColor="@android:color/black"
android:gravity="center_horizontal"></TextView>
<FrameLayout android:layout_height="fill_parent"
android:layout_width="fill_parent" android:id="@+id/frameLayout1"
- android:layout_below="@+id/textView1" android:layout_above="@+id/linearLayout1">
+ android:layout_below="@+id/drawer_username" android:layout_above="@+id/linearLayout1">
<ListView android:id="@android:id/list" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:divider="@drawable/uploader_list_separator"
android:dividerHeight="1dip"></ListView>
android:layout_gravity="center_vertical|center"
android:layout_margin="4dp"
android:src="@drawable/ic_menu_archive"
- android:id="@+id/imageView1" />
+ android:id="@+id/drawer_userIcon" />
<TextView
android:text="TextView"
android:layout_width="fill_parent"
- android:id="@+id/textView1"
+ android:id="@+id/drawer_username"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:layout_gravity="center_vertical"
android:showAsAction="always"
android:title="@string/actionbar_mkdir"/>
<item
- android:id="@+id/action_sync_account"
- android:icon="@drawable/ic_action_refresh"
- android:orderInCategory="2"
- android:showAsAction="never"
- android:title="@string/actionbar_sync"/>
- <item
- android:id="@+id/action_settings"
- android:icon="@drawable/ic_action_settings"
- android:orderInCategory="2"
- android:showAsAction="never"
- android:title="@string/actionbar_settings"/>
- <item
- android:id="@+id/action_logger"
- android:icon="@drawable/ic_action_settings"
- android:orderInCategory="2"
- android:showAsAction="never"
- android:title="@string/actionbar_logger"/>
- <item
android:id="@+id/action_sort"
- android:icon="@android:drawable/ic_menu_sort_alphabetically"
+ android:icon="@android:drawable/ic_menu_sort_by_size"
android:orderInCategory="2"
- android:showAsAction="never"
+ android:showAsAction="always"
android:title="@string/actionbar_sort"/>
<!-- <item android:id="@+id/search" android:title="@string/actionbar_search" android:icon="@drawable/ic_action_search"></item> -->
<color name="filelist_icon_backgorund">#DDDDDD</color>
<color name="owncloud_blue_bright">#00ddff</color>
<color name="list_item_lastmod_and_filesize_text">#989898</color>
+ <color name="black">#000000</color>
</resources>
\ No newline at end of file
<!-- TODO re-enable when server-side folder size calculation is available
<item>Biggest - Smallest</item> -->
</string-array>
+ <string-array name="drawer_items">
+ <item>Accounts</item>
+ <item>All Files</item>
+ <item>On device</item>
+ <item>Settings</item>
+ </string-array>
+ <string name="drawer_open">ownCloud</string>
+ <string name="drawer_close">Close</string>
<string name="prefs_category_general">General</string>
<string name="prefs_category_more">More</string>
<string name="prefs_accounts">Accounts</string>
<string name="shared_subject_header">shared</string>
<string name="with_you_subject_header">with you</string>
<string name="subject_token">%1$s %2$s >>%3$s<< %4$s</string>
+ <string name="username">Username</string>
</resources>
<PreferenceCategory android:title="@string/prefs_category_more" android:key="more">
<Preference android:title="@string/prefs_help" android:key="help" />
+ <Preference android:title="@string/actionbar_logger" android:key="log" />
<Preference android:title="@string/prefs_recommend" android:key="recommend" />
<Preference android:title="@string/prefs_feedback" android:key="feedback" />
<Preference android:title="@string/prefs_imprint" android:key="imprint" />
private static Context mContext;
+ // TODO better place
+ private static boolean mOnlyOnDevice = false;
+
+
public void onCreate(){
super.onCreate();
MainApp.mContext = getApplicationContext();
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;
+ }
}
import java.util.List;
import java.util.Vector;
-import com.owncloud.android.MainApp;
-import com.owncloud.android.db.ProviderMeta.ProviderTableMeta;
-import com.owncloud.android.lib.common.utils.Log_OC;
-import com.owncloud.android.lib.resources.shares.OCShare;
-import com.owncloud.android.lib.resources.shares.ShareType;
-import com.owncloud.android.lib.resources.files.FileUtils;
-import com.owncloud.android.utils.FileStorageUtils;
-
import android.accounts.Account;
import android.content.ContentProviderClient;
import android.content.ContentProviderOperation;
import android.net.Uri;
import android.os.RemoteException;
+import com.owncloud.android.MainApp;
+import com.owncloud.android.db.ProviderMeta.ProviderTableMeta;
+import com.owncloud.android.lib.common.utils.Log_OC;
+import com.owncloud.android.lib.resources.files.FileUtils;
+import com.owncloud.android.lib.resources.shares.OCShare;
+import com.owncloud.android.lib.resources.shares.ShareType;
+import com.owncloud.android.utils.FileStorageUtils;
+
public class FileDataStorageManager {
public static final int ROOT_PARENT_ID = 0;
}
- public Vector<OCFile> getFolderContent(OCFile f) {
+ public Vector<OCFile> getFolderContent(OCFile f, boolean onlyOnDevice) {
if (f != null && f.isFolder() && f.getFileId() != -1) {
- return getFolderContent(f.getFileId());
+ return getFolderContent(f.getFileId(), onlyOnDevice);
} else {
return new Vector<OCFile>();
}
- public Vector<OCFile> getFolderImages(OCFile folder) {
+ 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);
+ Vector<OCFile> tmp = getFolderContent(folder, onlyOnDevice);
OCFile current = null;
for (int i=0; i<tmp.size(); i++) {
current = tmp.get(i);
File localFolder = new File(FileStorageUtils.getDefaultSavePathFor(mAccount.name, folder));
if (localFolder.exists()) {
// stage 1: remove the local files already registered in the files database
- Vector<OCFile> files = getFolderContent(folder.getFileId());
+ Vector<OCFile> files = getFolderContent(folder.getFileId(), false);
if (files != null) {
for (OCFile file : files) {
if (file.isFolder()) {
}
- private Vector<OCFile> getFolderContent(long parentId) {
+ private Vector<OCFile> getFolderContent(long parentId, boolean onlyOnDevice) {
Vector<OCFile> ret = new Vector<OCFile>();
if (c.moveToFirst()) {
do {
OCFile child = createFileInstance(c);
- ret.add(child);
+ if (child.isFolder() || !onlyOnDevice || onlyOnDevice && child.isDown()){
+ ret.add(child);
+ }
} while (c.moveToNext());
}
}
private ArrayList<ContentProviderOperation> prepareRemoveSharesInFolder(
- OCFile folder, ArrayList<ContentProviderOperation> preparedOperations
- ) {
+ OCFile folder, ArrayList<ContentProviderOperation> preparedOperations) {
if (folder != null) {
String where = ProviderTableMeta.OCSHARES_PATH + "=?" + " AND "
+ ProviderTableMeta.OCSHARES_ACCOUNT_OWNER + "=?";
String [] whereArgs = new String[]{ "", mAccount.name };
- Vector<OCFile> files = getFolderContent(folder);
+ Vector<OCFile> files = getFolderContent(folder, false);
for (OCFile file : files) {
whereArgs[0] = file.getRemotePath();
import java.util.Vector;
import org.apache.http.HttpStatus;
+
import android.accounts.Account;
import android.content.Context;
import android.content.Intent;
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.OCFile;
-
import com.owncloud.android.lib.common.OwnCloudClient;
-import com.owncloud.android.lib.resources.shares.OCShare;
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.shares.GetRemoteSharesForFileOperation;
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.utils.FileStorageUtils;
if (mRemoteFolderChanged) {
result = fetchAndSyncRemoteFolder(client);
} else {
- mChildren = mStorageManager.getFolderContent(mLocalFolder);
+ mChildren = mStorageManager.getFolderContent(mLocalFolder, false);
}
}
List<SynchronizeFileOperation> filesToSyncContents = new Vector<SynchronizeFileOperation>();
// get current data about local contents of the folder to synchronize
- List<OCFile> localFiles = mStorageManager.getFolderContent(mLocalFolder);
+ 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);
import android.accounts.AccountManager;
import android.accounts.AuthenticatorException;
import android.accounts.OperationCanceledException;
-import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.ServiceConnection;
import android.content.SharedPreferences;
import android.content.SyncRequest;
+import android.content.res.Configuration;
import android.content.res.Resources.NotFoundException;
import android.database.Cursor;
import android.net.Uri;
import android.provider.DocumentsContract;
import android.provider.MediaStore;
import android.provider.OpenableColumns;
+import android.support.v4.app.ActionBarDrawerToggle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
+import android.support.v4.view.GravityCompat;
+import android.support.v4.widget.DrawerLayout;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
+import android.widget.AdapterView;
+import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import com.actionbarsherlock.view.MenuInflater;
import com.actionbarsherlock.view.MenuItem;
import com.actionbarsherlock.view.Window;
-import com.owncloud.android.BuildConfig;
import com.owncloud.android.MainApp;
import com.owncloud.android.R;
+import com.owncloud.android.authentication.AccountUtils;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.files.services.FileDownloader;
import com.owncloud.android.files.services.FileDownloader.FileDownloaderBinder;
import com.owncloud.android.services.observer.FileObserverService;
import com.owncloud.android.syncadapter.FileSyncAdapter;
import com.owncloud.android.ui.adapter.FileListListAdapter;
+import com.owncloud.android.ui.adapter.NavigationDrawerListAdapter;
import com.owncloud.android.ui.dialog.CreateFolderDialogFragment;
import com.owncloud.android.ui.dialog.SslUntrustedCertDialog;
import com.owncloud.android.ui.dialog.SslUntrustedCertDialog.OnSslUntrustedCertListener;
private String DIALOG_UNTRUSTED_CERT;
private OCFile mWaitingToSend;
-
+
+
+ private DrawerLayout mDrawerLayout;
+ private ActionBarDrawerToggle mDrawerToggle;
+ private boolean showAccounts = false;
+
@Override
protected void onCreate(Bundle savedInstanceState) {
Log_OC.d(TAG, "onCreate() start");
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
-
+
super.onCreate(savedInstanceState); // this calls onAccountChanged() when ownCloud Account is valid
// PIN CODE request ; best location is to decide, let's try this first
/// USER INTERFACE
// Inflate and set the layout view
- setContentView(R.layout.files);
+ setContentView(R.layout.files);
+
+ // TODO move to another place that all activity can use it
+ mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
+
+ mDrawerToggle = new ActionBarDrawerToggle(
+ this,
+ mDrawerLayout,
+ R.drawable.ic_drawer,
+ R.string.drawer_open,
+ R.string.empty
+ ) {
+
+ /** Called when a drawer has settled in a completely closed state. */
+ public void onDrawerClosed(View view) {
+ super.onDrawerClosed(view);
+ getSupportActionBar().setDisplayShowTitleEnabled(true);
+ getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
+ initFragmentsWithFile();
+ invalidateOptionsMenu();
+ }
+
+ /** Called when a drawer has settled in a completely open state. */
+ public void onDrawerOpened(View drawerView) {
+ super.onDrawerOpened(drawerView);
+ getSupportActionBar().setTitle(R.string.drawer_open);
+ getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
+ invalidateOptionsMenu();
+ }
+ };
+
+ mDrawerToggle.setDrawerIndicatorEnabled(true);
+
+ // Notification Drawer
+ LinearLayout notificatonDrawer = (LinearLayout) findViewById(R.id.left_drawer);
+
+ // ListView
+ ListView listView = (ListView) notificatonDrawer.findViewById(R.id.drawer_list);
+ final NavigationDrawerListAdapter adapter = new NavigationDrawerListAdapter(getApplicationContext(), this);
+
+ listView.setAdapter(adapter);
+
+ listView.setOnItemClickListener(new OnItemClickListener() {
+ @Override
+ public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
+ if (showAccounts && position > 0){
+ position = position - 1;
+ }
+ switch (position){
+ case 0:
+ showAccounts = !showAccounts;
+ adapter.setShowAccounts(showAccounts);
+ adapter.notifyDataSetChanged();
+ break;
+ case 1:
+ MainApp.showOnlyFilesOnDevice(false);
+ mDrawerLayout.closeDrawers();
+ break;
+ case 2:
+ MainApp.showOnlyFilesOnDevice(true);
+ mDrawerLayout.closeDrawers();
+ break;
+ case 3:
+ Intent settingsIntent = new Intent(getApplicationContext(), Preferences.class);
+ startActivity(settingsIntent);
+ break;
+ }
+ }
+ });
+
+ // User-Icon
+ ImageView userIcon = (ImageView) notificatonDrawer.findViewById(R.id.drawer_userIcon);
+ userIcon.setImageResource(DisplayUtils.getSeasonalIconId());
+
+ // 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));
+
+ // Set the drawer toggle as the DrawerListener
+ mDrawerLayout.setDrawerListener(mDrawerToggle);
+
mDualPane = getResources().getBoolean(R.bool.large_land_layout);
mLeftFragmentContainer = findViewById(R.id.left_fragment_container);
mRightFragmentContainer = findViewById(R.id.right_fragment_container);
// Action bar setup
mDirectories = new CustomArrayAdapter<String>(this, R.layout.sherlock_spinner_dropdown_item);
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true); // mandatory since Android ICS, according to the official documentation
+ getSupportActionBar().setDisplayShowCustomEnabled(true); // CRUCIAL - for displaying your custom actionbar
+ getSupportActionBar().setDisplayShowTitleEnabled(true);
setSupportProgressBarIndeterminateVisibility(mSyncInProgress /*|| mRefreshSharesInProgress*/); // always AFTER setContentView(...) ; to work around bug in its implementation
+ mDrawerToggle.syncState();
+
setBackgroundText();
Log_OC.d(TAG, "onCreate() end");
super.onStart();
getSupportActionBar().setIcon(DisplayUtils.getSeasonalIconId());
}
+
+ @Override
+ protected void onPostCreate(Bundle savedInstanceState) {
+ super.onPostCreate(savedInstanceState);
+ // Sync the toggle state after onRestoreInstanceState has occurred.
+ mDrawerToggle.syncState();
+ }
+
+ @Override
+ public void onConfigurationChanged(Configuration newConfig) {
+ super.onConfigurationChanged(newConfig);
+ mDrawerToggle.onConfigurationChanged(newConfig);
+ }
@Override
protected void onDestroy() {
/// First fragment
OCFileListFragment listOfFiles = getListOfFilesFragment();
if (listOfFiles != null) {
- listOfFiles.listDirectory(getCurrentDir());
+ listOfFiles.listDirectory(getCurrentDir(), MainApp.getOnlyOnDevice());
} else {
Log_OC.e(TAG, "Still have a chance to lose the initializacion of list fragment >(");
}
protected void refreshListOfFilesFragment() {
OCFileListFragment fileListFragment = getListOfFilesFragment();
if (fileListFragment != null) {
- fileListFragment.listDirectory();
+ fileListFragment.listDirectory(MainApp.getOnlyOnDevice());
}
}
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
- if (BuildConfig.DEBUG) {
- menu.findItem(R.id.action_logger).setVisible(true);
- } else {
- menu.findItem(R.id.action_logger).setVisible(false);
- }
+ boolean drawerOpen = mDrawerLayout.isDrawerOpen(GravityCompat.START);
+ menu.findItem(R.id.action_upload).setVisible(!drawerOpen);
+ menu.findItem(R.id.action_create_dir).setVisible(!drawerOpen);
+ menu.findItem(R.id.action_sort).setVisible(!drawerOpen);
+
return super.onPrepareOptionsMenu(menu);
}
inflater.inflate(R.menu.main_menu, menu);
return true;
}
+
@Override
public boolean onOptionsItemSelected(MenuItem item) {
dialog.show(getSupportFragmentManager(), "createdirdialog");
break;
}
- case R.id.action_sync_account: {
- startSynchronization();
- break;
- }
case R.id.action_upload: {
showDialog(DIALOG_CHOOSE_UPLOAD_SOURCE);
break;
}
- case R.id.action_settings: {
- Intent settingsIntent = new Intent(this, Preferences.class);
- startActivity(settingsIntent);
- break;
- }
- case R.id.action_logger: {
- Intent loggerIntent = new Intent(getApplicationContext(),LogHistoryActivity.class);
- startActivity(loggerIntent);
- break;
- }
case android.R.id.home: {
- FileFragment second = getSecondFragment();
- OCFile currentDir = getCurrentDir();
- if((currentDir != null && currentDir.getParentId() != 0) ||
- (second != null && second.getFile() != null)) {
- onBackPressed();
-
+ if (mDrawerLayout.isDrawerOpen(GravityCompat.START)) {
+ mDrawerLayout.closeDrawer(GravityCompat.START);
+ } else {
+ mDrawerLayout.openDrawer(GravityCompat.START);
}
+ // TODO add hamburger to left of android.R.id.home
break;
}
case R.id.action_sort: {
if (synchFolderRemotePath != null && currentDir.getRemotePath().equals(synchFolderRemotePath)) {
OCFileListFragment fileListFragment = getListOfFilesFragment();
if (fileListFragment != null) {
- fileListFragment.listDirectory(currentDir);
+ fileListFragment.listDirectory(currentDir, MainApp.getOnlyOnDevice());
}
}
setFile(currentFile);
popDirname();
}
OCFile root = getStorageManager().getFileByPath(OCFile.ROOT_PATH);
- listOfFiles.listDirectory(root);
+ listOfFiles.listDirectory(root, MainApp.getOnlyOnDevice());
setFile(listOfFiles.getCurrentFile());
startSyncFolderOperation(root, false);
}
OCFileListFragment listOfFiles = getListOfFilesFragment();
if (listOfFiles != null) {
setNavigationListWithFolder(folder);
- listOfFiles.listDirectory(folder);
+ listOfFiles.listDirectory(folder, MainApp.getOnlyOnDevice());
setFile(listOfFiles.getCurrentFile());
startSyncFolderOperation(folder, false);
} else {
// only list of files - set for browsing through folders
OCFile currentDir = getCurrentDir();
boolean noRoot = (currentDir != null && currentDir.getParentId() != 0);
- actionBar.setDisplayHomeAsUpEnabled(noRoot);
- actionBar.setDisplayShowTitleEnabled(!noRoot);
+// actionBar.setDisplayHomeAsUpEnabled(noRoot);
+// actionBar.setDisplayShowTitleEnabled(!noRoot);
+ actionBar.setDisplayHomeAsUpEnabled(true);
+ actionBar.setDisplayShowTitleEnabled(true);
if (!noRoot) {
actionBar.setTitle(getString(R.string.default_display_name_for_root_folder));
}
// a new chance to get the mDownloadBinder through getFileDownloadBinder() - THIS IS A MESS
OCFileListFragment listOfFiles = getListOfFilesFragment();
if (listOfFiles != null) {
- listOfFiles.listDirectory();
+ listOfFiles.listDirectory(MainApp.getOnlyOnDevice());
}
FileFragment secondFragment = getSecondFragment();
if (secondFragment != null && secondFragment instanceof FileDetailFragment) {
private void sortByName(boolean ascending){
getListOfFilesFragment().sortByName(ascending);
}
+
+ public void restart(){
+ Intent i = new Intent(this, FileDisplayActivity.class);
+ i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+ startActivity(i);
+ }
+
+ public void closeDrawer() {
+ mDrawerLayout.closeDrawers();
+ }
}
if (!stateWasRecovered) {
OCFileListFragment listOfFolders = getListOfFilesFragment();
- listOfFolders.listDirectory(folder);
+ listOfFolders.listDirectory(folder, false);
startSyncFolderOperation(folder, false);
}
MenuInflater inflater = getSherlock().getMenuInflater();
inflater.inflate(R.menu.main_menu, menu);
menu.findItem(R.id.action_upload).setVisible(false);
- menu.findItem(R.id.action_settings).setVisible(false);
- menu.findItem(R.id.action_sync_account).setVisible(false);
- menu.findItem(R.id.action_logger).setVisible(false);
menu.findItem(R.id.action_sort).setVisible(false);
return true;
}
protected void refreshListOfFilesFragment() {
OCFileListFragment fileListFragment = getListOfFilesFragment();
if (fileListFragment != null) {
- fileListFragment.listDirectory();
+ fileListFragment.listDirectory(false);
}
}
OCFileListFragment listOfFiles = getListOfFilesFragment();
if (listOfFiles != null) { // should never be null, indeed
OCFile root = getStorageManager().getFileByPath(OCFile.ROOT_PATH);
- listOfFiles.listDirectory(root);
+ listOfFiles.listDirectory(root, false);
setFile(listOfFiles.getCurrentFile());
updateNavigationElementsInActionBar();
startSyncFolderOperation(root, false);
equals(synchFolderRemotePath)) {
OCFileListFragment fileListFragment = getListOfFilesFragment();
if (fileListFragment != null) {
- fileListFragment.listDirectory(currentDir);
+ fileListFragment.listDirectory(currentDir, false);
}
}
setFile(currentFile);
import com.actionbarsherlock.app.SherlockPreferenceActivity;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem;
+import com.owncloud.android.BuildConfig;
import com.owncloud.android.MainApp;
import com.owncloud.android.R;
import com.owncloud.android.authentication.AccountUtils;
private Preference mPrefInstantVideoUploadPath;
private String mUploadVideoPath;
-
@SuppressWarnings("deprecation")
@Override
public void onCreate(Bundle savedInstanceState) {
}
-
+ if (BuildConfig.DEBUG) {
+ Preference pLog = findPreference("log");
+ if (pLog != null ){
+ pLog.setOnPreferenceClickListener(new OnPreferenceClickListener() {
+ @Override
+ public boolean onPreferenceClick(Preference preference) {
+ Intent loggerIntent = new Intent(getApplicationContext(),LogHistoryActivity.class);
+ startActivity(loggerIntent);
+ return true;
+ }
+ });
+ }
+ }
+
boolean recommendEnabled = getResources().getBoolean(R.bool.recommend_enabled);
Preference pRecommend = findPreference("recommend");
if (pRecommend != null){
package com.owncloud.android.ui.activity;
import android.accounts.Account;
-
import android.os.Bundle;
import android.view.View.OnClickListener;
if (!stateWasRecovered) {
OCFileListFragment listOfFolders = getListOfFilesFragment();
- listOfFolders.listDirectory(folder);
+ listOfFolders.listDirectory(folder, false);
startSyncFolderOperation(folder, false);
}
import java.util.Stack;
import java.util.Vector;
-import com.owncloud.android.MainApp;
-import com.owncloud.android.R;
-import com.owncloud.android.authentication.AccountAuthenticator;
-import com.owncloud.android.datamodel.FileDataStorageManager;
-import com.owncloud.android.datamodel.OCFile;
-import com.owncloud.android.files.services.FileUploader;
-import com.owncloud.android.lib.common.utils.Log_OC;
-
import android.accounts.Account;
import android.accounts.AccountManager;
import android.app.AlertDialog;
import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.SherlockListActivity;
import com.actionbarsherlock.view.MenuItem;
+import com.owncloud.android.MainApp;
+import com.owncloud.android.R;
+import com.owncloud.android.authentication.AccountAuthenticator;
+import com.owncloud.android.datamodel.FileDataStorageManager;
+import com.owncloud.android.datamodel.OCFile;
+import com.owncloud.android.files.services.FileUploader;
+import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.utils.DisplayUtils;
/**
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 = mStorageManager.getFolderContent(mFile);
+ Vector<OCFile> tmpfiles = mStorageManager.getFolderContent(mFile, false);
if (tmpfiles.size() <= 0) return;
// filter on dirtype
Vector<OCFile> files = new Vector<OCFile>();
mFile = mStorageManager.getFileByPath(full_path);
if (mFile != null) {
- Vector<OCFile> files = mStorageManager.getFolderContent(mFile);
+ Vector<OCFile> files = mStorageManager.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>();
data,
R.layout.uploader_list_item_layout,
new String[] {"dirname"},
- new int[] {R.id.textView1});
+ new int[] {R.id.drawer_username});
setListAdapter(sa);
Button btn = (Button) findViewById(R.id.uploader_choose_folder);
btn.setOnClickListener(this);
String name = file.getFileName();\r
\r
fileName.setText(name);\r
- ImageView fileIcon = (ImageView) view.findViewById(R.id.imageView1);\r
+ ImageView fileIcon = (ImageView) view.findViewById(R.id.drawer_userIcon);\r
fileIcon.setTag(file.getFileId());\r
ImageView sharedIconV = (ImageView) view.findViewById(R.id.sharedIcon);\r
ImageView sharedWithMeIconV = (ImageView) view.findViewById(R.id.sharedWithMeIcon);\r
* @param updatedStorageManager Optional updated storage manager; used to replace \r
* mStorageManager if is different (and not NULL)\r
*/\r
- public void swapDirectory(OCFile directory, FileDataStorageManager updatedStorageManager) {\r
+ public void swapDirectory(OCFile directory, FileDataStorageManager updatedStorageManager, boolean onlyOnDevice) {\r
mFile = directory;\r
if (updatedStorageManager != null && updatedStorageManager != mStorageManager) {\r
mStorageManager = updatedStorageManager;\r
mAccount = AccountUtils.getCurrentOwnCloudAccount(mContext);\r
}\r
if (mStorageManager != null) {\r
- mFiles = mStorageManager.getFolderContent(mFile);\r
+ mFiles = mStorageManager.getFolderContent(mFile, onlyOnDevice);\r
if (mJustFolders) {\r
mFiles = getFolders(mFiles);\r
}\r
--- /dev/null
+package com.owncloud.android.ui.adapter;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class Group {
+
+ public String string;
+ public final List<String> children = new ArrayList<String>();
+
+ public Group(String string) {
+ this.string = string;
+ }
+
+}
\ No newline at end of file
String name = file.getName();
fileName.setText(name);
- ImageView fileIcon = (ImageView) view.findViewById(R.id.imageView1);
+ ImageView fileIcon = (ImageView) view.findViewById(R.id.drawer_userIcon);
if (!file.isDirectory()) {
fileIcon.setImageResource(R.drawable.file);
} else {
--- /dev/null
+package com.owncloud.android.ui.adapter;
+
+import android.app.Activity;
+import android.util.SparseArray;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.ViewGroup;
+import android.widget.BaseExpandableListAdapter;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.owncloud.android.R;
+
+public class MyExpandableListAdapter extends BaseExpandableListAdapter {
+
+ private final SparseArray<Group> groups;
+ public LayoutInflater inflater;
+ public Activity activity;
+
+ public MyExpandableListAdapter(Activity act, SparseArray<Group> groups) {
+ activity = act;
+ this.groups = groups;
+ inflater = act.getLayoutInflater();
+
+ }
+
+
+ @Override
+ public Object getChild(int groupPosition, int childPosition) {
+ return groups.get(groupPosition).children.get(childPosition);
+ }
+
+ @Override
+ public long getChildId(int groupPosition, int childPosition) {
+ return 0;
+ }
+
+ @Override
+ public View getChildView(int groupPosition, final int childPosition,
+ boolean isLastChild, View convertView, ViewGroup parent) {
+ final String children = (String) getChild(groupPosition, childPosition);
+ TextView text = null;
+ if (convertView == null) {
+ convertView = inflater.inflate(R.layout.listrow_details, null);
+ }
+
+
+ text = (TextView) convertView.findViewById(R.id.textView1);
+ text.setText(children);
+ convertView.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ Toast.makeText(activity, children, Toast.LENGTH_SHORT).show();
+ }
+ });
+ return convertView;
+ }
+
+ @Override
+ public View getGroupView(int groupPosition, boolean isExpanded,
+ View convertView, ViewGroup parent) {
+ if (convertView == null) {
+ convertView = inflater.inflate(R.layout.listrow_group, null);
+ }
+
+ final Group group = (Group) getGroup(groupPosition);
+ if (group.children.size() == 0){
+ convertView.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ Toast.makeText(activity, group.string, Toast.LENGTH_SHORT).show();
+ }
+ });
+ }
+ ((TextView) convertView).setText(group.string);
+
+ return convertView;
+ }
+
+ @Override
+ public int getChildrenCount(int groupPosition) {
+ return groups.get(groupPosition).children.size();
+ }
+
+ @Override
+ public Object getGroup(int groupPosition) {
+ return groups.get(groupPosition);
+ }
+
+ @Override
+ public int getGroupCount() {
+ return groups.size();
+ }
+
+ @Override
+ public void onGroupCollapsed(int groupPosition) {
+ super.onGroupCollapsed(groupPosition);
+ }
+
+ @Override
+ public void onGroupExpanded(int groupPosition) {
+ super.onGroupExpanded(groupPosition);
+ }
+
+ @Override
+ public long getGroupId(int groupPosition) {
+ return 0;
+ }
+
+ @Override
+ public boolean hasStableIds() {
+ return false;
+ }
+
+ @Override
+ public boolean isChildSelectable(int groupPosition, int childPosition) {
+ return false;
+ }
+}
\ No newline at end of file
--- /dev/null
+package com.owncloud.android.ui.adapter;
+
+import java.util.ArrayList;
+
+import android.accounts.Account;
+import android.accounts.AccountManager;
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.BaseAdapter;
+import android.widget.RadioButton;
+import android.widget.RadioGroup;
+import android.widget.RadioGroup.LayoutParams;
+import android.widget.TextView;
+
+import com.owncloud.android.MainApp;
+import com.owncloud.android.R;
+import com.owncloud.android.authentication.AccountUtils;
+import com.owncloud.android.ui.activity.FileDisplayActivity;
+
+public class NavigationDrawerListAdapter extends BaseAdapter {
+
+ private final static String TAG = "NavigationDrawerListAdapter";
+ private Context mContext;
+ private ArrayList<String> mDrawerItems = new ArrayList<String>();
+ ArrayList<Object> all = new ArrayList<Object>();
+ private Account[] mAccounts;
+ private boolean mShowAccounts;
+ private Account currentAccount;
+ private FileDisplayActivity mFileDisplayActivity;
+
+
+ public NavigationDrawerListAdapter(Context context, FileDisplayActivity fileDisplayActivity){
+ mFileDisplayActivity = fileDisplayActivity;
+ mContext = context;
+
+ for (String string : mContext.getResources().getStringArray(R.array.drawer_items)) {
+ mDrawerItems.add(string);
+ }
+
+ AccountManager am = (AccountManager) mContext.getSystemService(mContext.ACCOUNT_SERVICE);
+ mAccounts = am.getAccountsByType(MainApp.getAccountType());
+ currentAccount = AccountUtils.getCurrentOwnCloudAccount(mContext);
+
+ all.addAll(mDrawerItems);
+ }
+
+ @Override
+ public int getCount() {
+ if (mShowAccounts){
+ return mDrawerItems.size() + 1;
+ } else {
+ return mDrawerItems.size();
+ }
+ }
+
+ @Override
+ public Object getItem(int position) {
+ //return all.get(position);
+ return null;
+ }
+
+ @Override
+ public long getItemId(int position) {
+ return 0;
+ }
+
+ @Override
+ public View getView(int position, View convertView, ViewGroup parent) {
+
+ LayoutInflater inflator = (LayoutInflater) mContext
+ .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+
+ if (all.size() > position) {
+ // Normal entry
+ if (all.get(position) instanceof String){
+ View view = inflator.inflate(R.layout.drawer_list_item, null);
+ view.setMinimumHeight(40);
+ TextView textView = (TextView) view.findViewById(R.id.drawer_textView);
+
+ String entry = (String) all.get(position);
+ textView.setText(entry);
+
+ return view;
+ }
+
+ // Account
+ if (all.get(position) instanceof Account[]){
+ final View view = inflator.inflate(R.layout.drawer_account_group, null);
+
+ final RadioGroup group = (RadioGroup) view.findViewById(R.id.drawer_radio_group);
+
+ for (Account account : mAccounts) {
+ RadioButton rb = new RadioButton(mContext);
+ rb.setText(account.name);
+ rb.setTextColor(mContext.getResources().getColor(R.color.black));
+
+ RadioGroup.LayoutParams params = new RadioGroup.LayoutParams(
+ LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
+ params.weight=1.0f;
+ params.setMargins(15, 5, 5, 5);
+
+ // Check the current account that is being used
+ if (account.name.equals(currentAccount.name)) {
+ rb.setChecked(true);
+ } else {
+ rb.setChecked(false);
+ }
+
+ group.addView(rb, params);
+ }
+
+ group.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener(){
+ public void onCheckedChanged(RadioGroup group, int checkedId) {
+ // checkedId is the RadioButton selected
+ RadioButton rb = (RadioButton) view.findViewById(checkedId);
+
+ AccountUtils.setCurrentOwnCloudAccount(mContext,rb.getText().toString());
+ notifyDataSetChanged();
+ mFileDisplayActivity.closeDrawer();
+
+ // restart the main activity
+ mFileDisplayActivity.restart();
+ }
+ });
+
+ return view;
+ }
+ }
+ return convertView;
+ }
+
+ public void setShowAccounts(boolean value){
+ all.clear();
+ all.addAll(mDrawerItems);
+
+ if (value){
+ all.add(1, mAccounts);
+ }
+ mShowAccounts = value;
+ }
+}
boolean containsKeepInSync = false;
if (mTargetFile.isFolder()) {
- Vector<OCFile> files = storageManager.getFolderContent(mTargetFile);
+ Vector<OCFile> files = storageManager.getFolderContent(mTargetFile, false);
for(OCFile file: files) {
containsKeepInSync = file.keepInSync() || containsKeepInSync;
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 android.view.LayoutInflater;
+import com.owncloud.android.MainApp;
import com.owncloud.android.R;
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.OCFile;
private View mFooterView;
private OCFile mTargetFile;
-
+
+
/**
* {@inheritDoc}
} // exit is granted because storageManager.getFileByPath("/") never returns null
mFile = parentDir;
- listDirectory(mFile);
+ listDirectory(mFile, MainApp.getOnlyOnDevice());
onRefresh(false);
if (file != null) {
if (file.isFolder()) {
// update state and view of this fragment
- listDirectory(file);
+ listDirectory(file, MainApp.getOnlyOnDevice());
// then, notify parent activity to let it update its state and view
mContainerActivity.onBrowsedDownTo(file);
// save index and top position
/**
* Calls {@link OCFileListFragment#listDirectory(OCFile)} with a null parameter
*/
- public void listDirectory(){
- listDirectory(null);
+ public void listDirectory(boolean onlyOnDevice){
+ listDirectory(null, onlyOnDevice);
+ }
+
+ public void refreshDirectory(){
+ listDirectory(getCurrentFile(), MainApp.getOnlyOnDevice());
}
/**
*
* @param directory File to be listed
*/
- public void listDirectory(OCFile directory) {
+ public void listDirectory(OCFile directory, boolean onlyOnDevice) {
FileDataStorageManager storageManager = mContainerActivity.getStorageManager();
if (storageManager != null) {
directory = storageManager.getFileById(directory.getParentId());
}
- mAdapter.swapDirectory(directory, storageManager);
+ mAdapter.swapDirectory(directory, storageManager, onlyOnDevice);
if (mFile == null || !mFile.equals(directory)) {
mList.setSelectionFromTop(0, 0);
}
// Update Footer
TextView footerText = (TextView) mFooterView.findViewById(R.id.footerText);
Log_OC.d("footer", String.valueOf(System.currentTimeMillis()));
- footerText.setText(generateFooterText(directory));
+ footerText.setText(generateFooterText(directory, onlyOnDevice));
Log_OC.d("footer", String.valueOf(System.currentTimeMillis()));
}
}
- private String generateFooterText(OCFile directory) {
+ private String generateFooterText(OCFile directory, boolean onlyOnDevice) {
Integer files = 0;
Integer folders = 0;
FileDataStorageManager storageManager = mContainerActivity.getStorageManager();
- Vector<OCFile> mFiles = storageManager.getFolderContent(mFile);
+ Vector<OCFile> mFiles = storageManager.getFolderContent(mFile, onlyOnDevice);
for (OCFile ocFile : mFiles) {
if (ocFile.isFolder()) {
public void sortBySize(boolean descending) {
mAdapter.setSortOrder(FileListListAdapter.SORT_SIZE, descending);
}
-
+
+
+
}
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;
// should not be necessary
parentFolder = getStorageManager().getFileByPath(OCFile.ROOT_PATH);
}
- mPreviewImagePagerAdapter = new PreviewImagePagerAdapter(getSupportFragmentManager(), parentFolder, getAccount(), getStorageManager());
+ 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;
* @param parentFolder Folder where images will be searched for.
* @param storageManager Bridge to database.
*/
- public PreviewImagePagerAdapter(FragmentManager fragmentManager, OCFile parentFolder, Account account, FileDataStorageManager storageManager) {
+ public PreviewImagePagerAdapter(FragmentManager fragmentManager, OCFile parentFolder, Account account, FileDataStorageManager storageManager, boolean onlyOnDevice) {
super(fragmentManager);
if (fragmentManager == null) {
mAccount = account;
mStorageManager = storageManager;
- mImageFiles = mStorageManager.getFolderImages(parentFolder);
+ mImageFiles = mStorageManager.getFolderImages(parentFolder, onlyOnDevice);
mObsoleteFragments = new HashSet<Object>();
mObsoletePositions = new HashSet<Integer>();
mDownloadErrors = new HashSet<Integer>();