diff --git a/res/drawable-mdpi/ic_drawer.png b/res/drawable-mdpi/ic_drawer.png
new file mode 100644
index 0000000000..fb681ba263
Binary files /dev/null and b/res/drawable-mdpi/ic_drawer.png differ
diff --git a/res/drawable-xhdpi/ic_drawer.png b/res/drawable-xhdpi/ic_drawer.png
new file mode 100644
index 0000000000..b9bc3d70f1
Binary files /dev/null and b/res/drawable-xhdpi/ic_drawer.png differ
diff --git a/res/layout/drawer_list_item.xml b/res/layout/drawer_list_item.xml
index 630366e0bb..30f3843b44 100644
--- a/res/layout/drawer_list_item.xml
+++ b/res/layout/drawer_list_item.xml
@@ -1,25 +1,42 @@
+
-.
+-->
+
+
+ android:layout_height="wrap_content"
+ android:layout_alignParentLeft="true"
+ android:orientation="horizontal"
+ android:background="@color/background_color"
+ android:layout_marginTop="10dp"
+ android:layout_marginBottom="10dp">
+
+
+
diff --git a/res/layout/files.xml b/res/layout/files.xml
index 5d87b12667..b1050ff048 100644
--- a/res/layout/files.xml
+++ b/res/layout/files.xml
@@ -32,7 +32,7 @@
android:baselineAligned="false"
android:orientation="horizontal" >
-
+
-
-
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/left_drawer"
+ android:layout_width="240dp"
+ android:layout_height="match_parent"
+ android:layout_gravity="start"
+ android:background="@color/background_color"
+ android:baselineAligned="false"
+ android:clickable="true"
+ android:orientation="vertical">
-
+
+
+
+
+
+
+
+ android:layout_width="fill_parent"
+ android:layout_height="2dip"
+ android:background="@color/list_item_lastmod_and_filesize_text" />
+
-
-
-
-
-
\ No newline at end of file
diff --git a/res/values/drawer_resources.xml b/res/values/drawer_resources.xml
new file mode 100644
index 0000000000..ca0143baeb
--- /dev/null
+++ b/res/values/drawer_resources.xml
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+ - @string/prefs_accounts
+ - @string/drawer_item_all_files
+
+ - @string/actionbar_settings
+ - @string/actionbar_logger
+
+
+
+
+ - @string/drawer_item_accounts
+ - @string/drawer_item_all_files
+
+ - @string/drawer_item_settings
+ - @string/drawer_item_logs
+
+
+
\ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
index b9aeea495e..8a7d813960 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -20,12 +20,12 @@
-
- - Accounts
- - All Files
- - On device
- - Settings
-
+ Accounts
+ All files
+
+ Settings
+ Logs
ownCloud
Close
General
diff --git a/res/xml/preferences.xml b/res/xml/preferences.xml
index e1d0a476f4..4823a83f9b 100644
--- a/res/xml/preferences.xml
+++ b/res/xml/preferences.xml
@@ -56,7 +56,6 @@
-
diff --git a/src/com/owncloud/android/MainApp.java b/src/com/owncloud/android/MainApp.java
index 0d725e5ad2..c805f9f7f4 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 42f2c780d1..7db0a637f5 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 5a1cf856ee..2e3c46922b 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 d4423d118c..6bf1ef8264 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/NavigationDrawerItem.java b/src/com/owncloud/android/ui/NavigationDrawerItem.java
new file mode 100644
index 0000000000..44ed3eccb4
--- /dev/null
+++ b/src/com/owncloud/android/ui/NavigationDrawerItem.java
@@ -0,0 +1,56 @@
+/**
+ * ownCloud Android client application
+ *
+ * @author masensio
+ * Copyright (C) 2015 ownCloud Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ */
+
+package com.owncloud.android.ui;
+
+public class NavigationDrawerItem {
+
+ private String mTitle;
+ private String mContentDescription;
+
+ // Constructors
+ public NavigationDrawerItem(){}
+
+ public NavigationDrawerItem(String title){
+ mTitle = title;
+ }
+
+ public NavigationDrawerItem(String title, String contentDescription){
+ mTitle = title;
+ mContentDescription = contentDescription;
+ }
+
+ // Getters and Setters
+ public String getTitle() {
+ return mTitle;
+ }
+
+ public void setTitle(String title) {
+ this.mTitle = title;
+ }
+
+ public String getContentDescription() {
+ return mContentDescription;
+ }
+
+ public void setContentDescription(String contentDescription) {
+ this.mContentDescription = contentDescription;
+ }
+}
diff --git a/src/com/owncloud/android/ui/activity/FileDisplayActivity.java b/src/com/owncloud/android/ui/activity/FileDisplayActivity.java
index b820e13fad..c37d9271a3 100644
--- a/src/com/owncloud/android/ui/activity/FileDisplayActivity.java
+++ b/src/com/owncloud/android/ui/activity/FileDisplayActivity.java
@@ -23,11 +23,11 @@
package com.owncloud.android.ui.activity;
import java.io.File;
+import java.util.ArrayList;
import android.accounts.Account;
import android.accounts.AccountManager;
import android.accounts.AuthenticatorException;
-import android.accounts.OperationCanceledException;
import android.annotation.TargetApi;
import android.app.AlertDialog;
import android.content.BroadcastReceiver;
@@ -55,7 +55,6 @@ 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;
@@ -73,6 +72,7 @@ import com.actionbarsherlock.view.Menu;
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;
@@ -101,7 +101,7 @@ import com.owncloud.android.operations.RefreshFolderOperation;
import com.owncloud.android.operations.UnshareLinkOperation;
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.NavigationDrawerItem;
import com.owncloud.android.ui.adapter.NavigationDrawerListAdapter;
import com.owncloud.android.ui.dialog.ConfirmationDialogFragment;
import com.owncloud.android.ui.dialog.CreateFolderDialogFragment;
@@ -164,13 +164,22 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
private static String DIALOG_UPLOAD_SOURCE = "DIALOG_UPLOAD_SOURCE";
private static String DIALOG_CERT_NOT_SAVED = "DIALOG_CERT_NOT_SAVED";
- private NavigationDrawerListAdapter adapter = null;
-
private OCFile mWaitingToSend;
-
+
+ // Navigation Drawer
private DrawerLayout mDrawerLayout;
private ActionBarDrawerToggle mDrawerToggle;
- private boolean showAccounts = false;
+ private ListView mDrawerList;
+
+ // Slide menu items
+ private String[] mDrawerTitles;
+ private String[] mDrawerContentDescriptions;
+
+ private ArrayList mDrawerItems;
+
+ private NavigationDrawerListAdapter mNavigationDrawerAdapter = null;
+
+ private boolean mShowAccounts = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -202,16 +211,91 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
// Inflate and set the layout view
setContentView(R.layout.files);
- // TODO move to another place that all activity can use it
- mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
+ // Navigation Drawer
+ initDrawer();
+
+ mDualPane = getResources().getBoolean(R.bool.large_land_layout);
+ mLeftFragmentContainer = findViewById(R.id.left_fragment_container);
+ mRightFragmentContainer = findViewById(R.id.right_fragment_container);
+ if (savedInstanceState == null) {
+ createMinFragments();
+ }
+
+ // Action bar setup
+ mDirectories = new CustomArrayAdapter(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
+
+ // TODO Remove??, it is done in onPostCreate
+ mDrawerToggle.syncState();
+ setBackgroundText();
+
+ Log_OC.v(TAG, "onCreate() end");
+ }
+
+ private void initDrawer(){
+ mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
+ // Notification Drawer
+ LinearLayout navigationDrawerLayout = (LinearLayout) findViewById(R.id.left_drawer);
+ mDrawerList = (ListView) navigationDrawerLayout.findViewById(R.id.drawer_list);
+
+ // load Account in the Drawer Title
+ // User-Icon
+ ImageView userIcon = (ImageView) navigationDrawerLayout.findViewById(R.id.drawer_userIcon);
+ userIcon.setImageResource(DisplayUtils.getSeasonalIconId());
+
+ // Username
+ TextView username = (TextView) navigationDrawerLayout.findViewById(R.id.drawer_username);
+ Account account = AccountUtils.getCurrentOwnCloudAccount(getApplicationContext());
+
+ if (account != null) {
+ int lastAtPos = account.name.lastIndexOf("@");
+ username.setText(account.name.substring(0, lastAtPos));
+ }
+
+ // load slide menu items
+ mDrawerTitles = getResources().getStringArray(R.array.drawer_items);
+
+ // nav drawer content description from resources
+ mDrawerContentDescriptions = getResources().
+ getStringArray(R.array.drawer_content_descriptions);
+
+ // nav drawer items
+ mDrawerItems = new ArrayList();
+ // adding nav drawer items to array
+ // Accounts
+ mDrawerItems.add(new NavigationDrawerItem(mDrawerTitles[0], mDrawerContentDescriptions[0]));
+ // All Files
+ mDrawerItems.add(new NavigationDrawerItem(mDrawerTitles[1], mDrawerContentDescriptions[1]));
+
+ // TODO Enable when "On Device" is recovered
+ // On Device
+ //mDrawerItems.add(new NavigationDrawerItem(mDrawerTitles[2],
+ // mDrawerContentDescriptions[2]));
+
+ // Settings
+ mDrawerItems.add(new NavigationDrawerItem(mDrawerTitles[2], mDrawerContentDescriptions[2]));
+ // Logs
+ if (BuildConfig.DEBUG) {
+ mDrawerItems.add(new NavigationDrawerItem(mDrawerTitles[3],
+ mDrawerContentDescriptions[3]));
+ }
+
+ // setting the nav drawer list adapter
+ mNavigationDrawerAdapter = new NavigationDrawerListAdapter(getApplicationContext(), this,
+ mDrawerItems);
+ mDrawerList.setAdapter(mNavigationDrawerAdapter);
+
mDrawerToggle = new ActionBarDrawerToggle(
- this,
- mDrawerLayout,
- R.drawable.ic_drawer,
- R.string.drawer_open,
- R.string.empty
- ) {
+ 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) {
@@ -230,84 +314,15 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
invalidateOptionsMenu();
}
};
-
- mDrawerToggle.setDrawerIndicatorEnabled(true);
-
- // Notification Drawer
- LinearLayout notificatonDrawer = (LinearLayout) findViewById(R.id.left_drawer);
-
- // ListView
- ListView listView = (ListView) notificatonDrawer.findViewById(R.id.drawer_list);
- 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());
- if (account != null) {
- int lastAtPos = account.name.lastIndexOf("@");
- username.setText(account.name.substring(0, lastAtPos));
- }
+ mDrawerToggle.setDrawerIndicatorEnabled(true);
+ // Set the list's click listener
+ mDrawerList.setOnItemClickListener(new DrawerItemClickListener());
// 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);
- if (savedInstanceState == null) {
- createMinFragments();
- }
-
- // Action bar setup
- mDirectories = new CustomArrayAdapter(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.v(TAG, "onCreate() end");
}
-
+
@Override
protected void onStart() {
Log_OC.v(TAG, "onStart() start");
@@ -408,7 +423,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 +544,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());
}
}
@@ -623,19 +642,16 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
builder.setTitle(R.string.actionbar_sort_title)
.setSingleChoiceItems(R.array.actionbar_sortby, sortOrder , new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
-
switch (which){
- case 0:
- sortByName(true);
- break;
- case 1:
- sortByDate(false);
- break;
-
+ case 0:
+ sortByName(true);
+ break;
+ case 1:
+ sortByDate(false);
+ break;
}
-
+
dialog.dismiss();
-
}
});
builder.create().show();
@@ -895,7 +911,7 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
super.onResume();
// refresh Navigation Drawer account list
- adapter.updateAccountList();
+ mNavigationDrawerAdapter.updateAccountList();
// refresh list of files
refreshListOfFilesFragment();
@@ -1046,7 +1062,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 +1293,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 +1310,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 +1424,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) {
@@ -1886,4 +1910,43 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
mDrawerLayout.closeDrawers();
}
+ private class DrawerItemClickListener implements ListView.OnItemClickListener {
+ @Override
+ public void onItemClick(AdapterView> parent, View view, int position, long id) {
+ if (mShowAccounts && position > 0){
+ position = position - 1;
+ }
+ switch (position){
+ case 0: // Accounts
+ mShowAccounts = !mShowAccounts;
+ mNavigationDrawerAdapter.setShowAccounts(mShowAccounts);
+ mNavigationDrawerAdapter.notifyDataSetChanged();
+ break;
+
+ case 1: // All Files
+ // 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: // Settings
+ Intent settingsIntent = new Intent(getApplicationContext(),
+ Preferences.class);
+ startActivity(settingsIntent);
+ break;
+
+ case 3: // Logs
+ Intent loggerIntent = new Intent(getApplicationContext(),
+ LogHistoryActivity.class);
+ startActivity(loggerIntent);
+ break;
+ }
+ }
+ }
}
diff --git a/src/com/owncloud/android/ui/activity/FolderPickerActivity.java b/src/com/owncloud/android/ui/activity/FolderPickerActivity.java
index 6dec67d25c..f135dceae6 100644
--- a/src/com/owncloud/android/ui/activity/FolderPickerActivity.java
+++ b/src/com/owncloud/android/ui/activity/FolderPickerActivity.java
@@ -19,12 +19,9 @@
package com.owncloud.android.ui.activity;
-import java.io.IOException;
-
import android.accounts.Account;
import android.accounts.AccountManager;
import android.accounts.AuthenticatorException;
-import android.accounts.OperationCanceledException;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
@@ -45,7 +42,6 @@ import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuInflater;
import com.actionbarsherlock.view.MenuItem;
import com.actionbarsherlock.view.Window;
-import com.owncloud.android.MainApp;
import com.owncloud.android.R;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.lib.common.OwnCloudAccount;
@@ -142,7 +138,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 +306,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 +317,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 +471,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/Preferences.java b/src/com/owncloud/android/ui/activity/Preferences.java
index e7e76790c5..39fc314ce0 100644
--- a/src/com/owncloud/android/ui/activity/Preferences.java
+++ b/src/com/owncloud/android/ui/activity/Preferences.java
@@ -203,7 +203,7 @@ public class Preferences extends SherlockPreferenceActivity
}
}
-
+
if (BuildConfig.DEBUG) {
Preference pLog = findPreference("log");
if (pLog != null ){
@@ -215,7 +215,7 @@ public class Preferences extends SherlockPreferenceActivity
return true;
}
});
- }
+ }
}
boolean recommendEnabled = getResources().getBoolean(R.bool.recommend_enabled);
@@ -236,7 +236,8 @@ public class Preferences extends SherlockPreferenceActivity
Account currentAccount = AccountUtils.getCurrentOwnCloudAccount(Preferences.this);
String username = currentAccount.name.substring(0, currentAccount.name.lastIndexOf('@'));
- String recommendSubject = String.format(getString(R.string.recommend_subject), appName);
+ String recommendSubject = String.format(getString(R.string.recommend_subject),
+ appName);
String recommendText = String.format(getString(R.string.recommend_text),
appName, downloadUrl, username);
diff --git a/src/com/owncloud/android/ui/activity/UploadPathActivity.java b/src/com/owncloud/android/ui/activity/UploadPathActivity.java
index a4e9cb730a..db704d145c 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 7336af9632..bee923337d 100644
--- a/src/com/owncloud/android/ui/activity/Uploader.java
+++ b/src/com/owncloud/android/ui/activity/Uploader.java
@@ -70,18 +70,11 @@ 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.MainApp;
-import com.owncloud.android.R;
-import com.owncloud.android.authentication.AccountAuthenticator;
-import com.owncloud.android.datamodel.OCFile;
-import com.owncloud.android.files.services.FileUploader;
import com.owncloud.android.lib.common.operations.RemoteOperation;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
-import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.operations.CreateFolderOperation;
import com.owncloud.android.ui.dialog.CreateFolderDialogFragment;
import com.owncloud.android.ui.dialog.LoadingDialog;
@@ -332,7 +325,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 +411,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 43c308342d..c6ea0344d1 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/adapter/NavigationDrawerListAdapter.java b/src/com/owncloud/android/ui/adapter/NavigationDrawerListAdapter.java
index a88ecbc702..0a5b9562c8 100644
--- a/src/com/owncloud/android/ui/adapter/NavigationDrawerListAdapter.java
+++ b/src/com/owncloud/android/ui/adapter/NavigationDrawerListAdapter.java
@@ -1,3 +1,24 @@
+/**
+ * ownCloud Android client application
+ *
+ * @author tobiasKaminsky
+ * @author masensio
+ * Copyright (C) 2015 ownCloud Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ */
+
package com.owncloud.android.ui.adapter;
import java.nio.ByteBuffer;
@@ -20,6 +41,7 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
+import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.RadioGroup.LayoutParams;
@@ -29,6 +51,7 @@ import com.owncloud.android.MainApp;
import com.owncloud.android.R;
import com.owncloud.android.authentication.AccountUtils;
import com.owncloud.android.lib.common.utils.Log_OC;
+import com.owncloud.android.ui.NavigationDrawerItem;
import com.owncloud.android.ui.TextDrawable;
import com.owncloud.android.ui.activity.FileDisplayActivity;
import com.owncloud.android.utils.BitmapUtils;
@@ -37,41 +60,41 @@ import org.apache.commons.codec.binary.Hex;
public class NavigationDrawerListAdapter extends BaseAdapter {
- private final static String TAG = "NavigationDrawerListAdapter";
+ private final static String TAG = NavigationDrawerListAdapter.class.getSimpleName();
+
private Context mContext;
- private ArrayList mDrawerItems = new ArrayList();
- ArrayList