|
@@ -44,10 +44,8 @@ import android.support.v7.app.ActionBar;
|
|
import android.support.v7.app.ActionBarActivity;
|
|
import android.support.v7.app.ActionBarActivity;
|
|
import android.view.View;
|
|
import android.view.View;
|
|
import android.widget.AdapterView;
|
|
import android.widget.AdapterView;
|
|
-import android.widget.ImageView;
|
|
|
|
import android.widget.LinearLayout;
|
|
import android.widget.LinearLayout;
|
|
import android.widget.ListView;
|
|
import android.widget.ListView;
|
|
-import android.widget.TextView;
|
|
|
|
import android.widget.Toast;
|
|
import android.widget.Toast;
|
|
|
|
|
|
import com.owncloud.android.BuildConfig;
|
|
import com.owncloud.android.BuildConfig;
|
|
@@ -59,15 +57,14 @@ import com.owncloud.android.datamodel.FileDataStorageManager;
|
|
import com.owncloud.android.datamodel.OCFile;
|
|
import com.owncloud.android.datamodel.OCFile;
|
|
import com.owncloud.android.files.FileOperationsHelper;
|
|
import com.owncloud.android.files.FileOperationsHelper;
|
|
import com.owncloud.android.files.services.FileDownloader;
|
|
import com.owncloud.android.files.services.FileDownloader;
|
|
-import com.owncloud.android.files.services.FileUploader;
|
|
|
|
import com.owncloud.android.files.services.FileDownloader.FileDownloaderBinder;
|
|
import com.owncloud.android.files.services.FileDownloader.FileDownloaderBinder;
|
|
|
|
+import com.owncloud.android.files.services.FileUploader;
|
|
import com.owncloud.android.files.services.FileUploader.FileUploaderBinder;
|
|
import com.owncloud.android.files.services.FileUploader.FileUploaderBinder;
|
|
import com.owncloud.android.lib.common.operations.OnRemoteOperationListener;
|
|
import com.owncloud.android.lib.common.operations.OnRemoteOperationListener;
|
|
import com.owncloud.android.lib.common.operations.RemoteOperation;
|
|
import com.owncloud.android.lib.common.operations.RemoteOperation;
|
|
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
|
|
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
|
|
import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
|
|
import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
|
|
import com.owncloud.android.lib.common.utils.Log_OC;
|
|
import com.owncloud.android.lib.common.utils.Log_OC;
|
|
-import com.owncloud.android.lib.resources.files.FileUtils;
|
|
|
|
import com.owncloud.android.operations.CreateShareOperation;
|
|
import com.owncloud.android.operations.CreateShareOperation;
|
|
import com.owncloud.android.operations.SynchronizeFolderOperation;
|
|
import com.owncloud.android.operations.SynchronizeFolderOperation;
|
|
import com.owncloud.android.operations.UnshareLinkOperation;
|
|
import com.owncloud.android.operations.UnshareLinkOperation;
|
|
@@ -77,7 +74,6 @@ import com.owncloud.android.ui.NavigationDrawerItem;
|
|
import com.owncloud.android.ui.adapter.NavigationDrawerListAdapter;
|
|
import com.owncloud.android.ui.adapter.NavigationDrawerListAdapter;
|
|
import com.owncloud.android.ui.dialog.LoadingDialog;
|
|
import com.owncloud.android.ui.dialog.LoadingDialog;
|
|
import com.owncloud.android.ui.dialog.SharePasswordDialogFragment;
|
|
import com.owncloud.android.ui.dialog.SharePasswordDialogFragment;
|
|
-import com.owncloud.android.utils.DisplayUtils;
|
|
|
|
import com.owncloud.android.utils.ErrorMessageAdapter;
|
|
import com.owncloud.android.utils.ErrorMessageAdapter;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
@@ -157,7 +153,8 @@ public class FileActivity extends ActionBarActivity
|
|
|
|
|
|
protected NavigationDrawerListAdapter mNavigationDrawerAdapter = null;
|
|
protected NavigationDrawerListAdapter mNavigationDrawerAdapter = null;
|
|
|
|
|
|
- protected boolean mShowAccounts = false;
|
|
|
|
|
|
+ // TODO re-enable when "Accounts" is available in Navigation Drawer
|
|
|
|
+// protected boolean mShowAccounts = false;
|
|
|
|
|
|
/**
|
|
/**
|
|
* Loads the ownCloud {@link Account} and main {@link OCFile} to be handled by the instance of
|
|
* Loads the ownCloud {@link Account} and main {@link OCFile} to be handled by the instance of
|
|
@@ -304,19 +301,20 @@ public class FileActivity extends ActionBarActivity
|
|
LinearLayout navigationDrawerLayout = (LinearLayout) findViewById(R.id.left_drawer);
|
|
LinearLayout navigationDrawerLayout = (LinearLayout) findViewById(R.id.left_drawer);
|
|
mDrawerList = (ListView) navigationDrawerLayout.findViewById(R.id.drawer_list);
|
|
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));
|
|
|
|
- }
|
|
|
|
|
|
+ // TODO re-enable when "Accounts" is available in Navigation Drawer
|
|
|
|
+// // 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
|
|
// load slide menu items
|
|
mDrawerTitles = getResources().getStringArray(R.array.drawer_items);
|
|
mDrawerTitles = getResources().getStringArray(R.array.drawer_items);
|
|
@@ -328,10 +326,12 @@ public class FileActivity extends ActionBarActivity
|
|
// nav drawer items
|
|
// nav drawer items
|
|
mDrawerItems = new ArrayList<NavigationDrawerItem>();
|
|
mDrawerItems = new ArrayList<NavigationDrawerItem>();
|
|
// adding nav drawer items to array
|
|
// adding nav drawer items to array
|
|
|
|
+ // TODO re-enable when "Accounts" is available in Navigation Drawer
|
|
// Accounts
|
|
// Accounts
|
|
- mDrawerItems.add(new NavigationDrawerItem(mDrawerTitles[0], mDrawerContentDescriptions[0]));
|
|
|
|
|
|
+ // mDrawerItems.add(new NavigationDrawerItem(mDrawerTitles[0],
|
|
|
|
+ // mDrawerContentDescriptions[0]));
|
|
// All Files
|
|
// All Files
|
|
- mDrawerItems.add(new NavigationDrawerItem(mDrawerTitles[1], mDrawerContentDescriptions[1]));
|
|
|
|
|
|
+ mDrawerItems.add(new NavigationDrawerItem(mDrawerTitles[0], mDrawerContentDescriptions[0]));
|
|
|
|
|
|
// TODO Enable when "On Device" is recovered
|
|
// TODO Enable when "On Device" is recovered
|
|
// On Device
|
|
// On Device
|
|
@@ -339,11 +339,11 @@ public class FileActivity extends ActionBarActivity
|
|
// mDrawerContentDescriptions[2]));
|
|
// mDrawerContentDescriptions[2]));
|
|
|
|
|
|
// Settings
|
|
// Settings
|
|
- mDrawerItems.add(new NavigationDrawerItem(mDrawerTitles[2], mDrawerContentDescriptions[2]));
|
|
|
|
|
|
+ mDrawerItems.add(new NavigationDrawerItem(mDrawerTitles[1], mDrawerContentDescriptions[1]));
|
|
// Logs
|
|
// Logs
|
|
if (BuildConfig.DEBUG) {
|
|
if (BuildConfig.DEBUG) {
|
|
- mDrawerItems.add(new NavigationDrawerItem(mDrawerTitles[3],
|
|
|
|
- mDrawerContentDescriptions[3]));
|
|
|
|
|
|
+ mDrawerItems.add(new NavigationDrawerItem(mDrawerTitles[2],
|
|
|
|
+ mDrawerContentDescriptions[2]));
|
|
}
|
|
}
|
|
|
|
|
|
// setting the nav drawer list adapter
|
|
// setting the nav drawer list adapter
|
|
@@ -372,6 +372,7 @@ public class FileActivity extends ActionBarActivity
|
|
super.onDrawerOpened(drawerView);
|
|
super.onDrawerOpened(drawerView);
|
|
getSupportActionBar().setTitle(R.string.drawer_open);
|
|
getSupportActionBar().setTitle(R.string.drawer_open);
|
|
getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
|
|
getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
|
|
|
|
+ mDrawerToggle.setDrawerIndicatorEnabled(true);
|
|
invalidateOptionsMenu();
|
|
invalidateOptionsMenu();
|
|
}
|
|
}
|
|
};
|
|
};
|
|
@@ -818,9 +819,10 @@ public class FileActivity extends ActionBarActivity
|
|
startActivity(i);
|
|
startActivity(i);
|
|
}
|
|
}
|
|
|
|
|
|
- public void closeDrawer() {
|
|
|
|
- mDrawerLayout.closeDrawers();
|
|
|
|
- }
|
|
|
|
|
|
+// TODO re-enable when "Accounts" is available in Navigation Drawer
|
|
|
|
+// public void closeDrawer() {
|
|
|
|
+// mDrawerLayout.closeDrawers();
|
|
|
|
+// }
|
|
|
|
|
|
public void allFilesOption(){
|
|
public void allFilesOption(){
|
|
restart();
|
|
restart();
|
|
@@ -829,17 +831,19 @@ public class FileActivity extends ActionBarActivity
|
|
private class DrawerItemClickListener implements ListView.OnItemClickListener {
|
|
private class DrawerItemClickListener implements ListView.OnItemClickListener {
|
|
@Override
|
|
@Override
|
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
|
- if (mShowAccounts && position > 0){
|
|
|
|
- position = position - 1;
|
|
|
|
- }
|
|
|
|
|
|
+ // TODO re-enable when "Accounts" is available in Navigation Drawer
|
|
|
|
+// if (mShowAccounts && position > 0){
|
|
|
|
+// position = position - 1;
|
|
|
|
+// }
|
|
switch (position){
|
|
switch (position){
|
|
- case 0: // Accounts
|
|
|
|
- mShowAccounts = !mShowAccounts;
|
|
|
|
- mNavigationDrawerAdapter.setShowAccounts(mShowAccounts);
|
|
|
|
- mNavigationDrawerAdapter.notifyDataSetChanged();
|
|
|
|
- break;
|
|
|
|
|
|
+ // TODO re-enable when "Accounts" is available in Navigation Drawer
|
|
|
|
+// case 0: // Accounts
|
|
|
|
+// mShowAccounts = !mShowAccounts;
|
|
|
|
+// mNavigationDrawerAdapter.setShowAccounts(mShowAccounts);
|
|
|
|
+// mNavigationDrawerAdapter.notifyDataSetChanged();
|
|
|
|
+// break;
|
|
|
|
|
|
- case 1: // All Files
|
|
|
|
|
|
+ case 0: // All Files
|
|
allFilesOption();
|
|
allFilesOption();
|
|
mDrawerLayout.closeDrawers();
|
|
mDrawerLayout.closeDrawers();
|
|
break;
|
|
break;
|
|
@@ -850,13 +854,13 @@ public class FileActivity extends ActionBarActivity
|
|
// mDrawerLayout.closeDrawers();
|
|
// mDrawerLayout.closeDrawers();
|
|
// break;
|
|
// break;
|
|
|
|
|
|
- case 2: // Settings
|
|
|
|
|
|
+ case 1: // Settings
|
|
Intent settingsIntent = new Intent(getApplicationContext(),
|
|
Intent settingsIntent = new Intent(getApplicationContext(),
|
|
Preferences.class);
|
|
Preferences.class);
|
|
startActivity(settingsIntent);
|
|
startActivity(settingsIntent);
|
|
break;
|
|
break;
|
|
|
|
|
|
- case 3: // Logs
|
|
|
|
|
|
+ case 2: // Logs
|
|
Intent loggerIntent = new Intent(getApplicationContext(),
|
|
Intent loggerIntent = new Intent(getApplicationContext(),
|
|
LogHistoryActivity.class);
|
|
LogHistoryActivity.class);
|
|
startActivity(loggerIntent);
|
|
startActivity(loggerIntent);
|