import eu.alefzero.owncloud.R;\r
import eu.alefzero.owncloud.authenticator.AccountAuthenticator;\r
import eu.alefzero.owncloud.authenticator.AuthUtils;\r
+import eu.alefzero.owncloud.datamodel.DataStorageManager;\r
+import eu.alefzero.owncloud.datamodel.FileDataStorageManager;\r
import eu.alefzero.owncloud.datamodel.OCFile;\r
-import eu.alefzero.owncloud.ui.fragment.FileList;\r
+import eu.alefzero.owncloud.ui.fragment.FileListFragment;\r
import eu.alefzero.webdav.WebdavClient;\r
\r
/**\r
public class FileDisplayActivity extends SherlockFragmentActivity implements\r
OnNavigationListener {\r
private ArrayAdapter<String> mDirectories;\r
+ private DataStorageManager mStorageManager;\r
\r
private static final int DIALOG_CHOOSE_ACCOUNT = 0;\r
\r
final Account a = AuthUtils.getCurrentOwnCloudAccount(this);\r
builder.setView(dirName);\r
builder.setTitle(R.string.uploader_info_dirname);\r
+ dirName.setTextColor(R.color.setup_text_typed);\r
\r
builder.setPositiveButton(R.string.common_ok, new OnClickListener() {\r
public void onClick(DialogInterface dialog, int which) {\r
for (int i = mDirectories.getCount() - 2; i >= 0; --i) {\r
path += "/" + mDirectories.getItem(i);\r
}\r
- OCFile parent = new OCFile(getContentResolver(), a, path + "/");\r
- path += "/" + s + "/";\r
+ OCFile parent = mStorageManager.getFileByPath(path + "/");\r
+ path += s + "/";\r
Thread thread = new Thread(new DirectoryCreator(path, a));\r
thread.start();\r
- OCFile.createNewFile(getContentResolver(), a, path, 0, 0, 0,\r
- "DIR", parent.getFileId()).save();\r
+ \r
+ OCFile new_file = new OCFile(path);\r
+ new_file.setMimetype("DIR");\r
+ new_file.setParentId(parent.getParentId());\r
+ mStorageManager.saveFile(new_file);\r
\r
dialog.dismiss();\r
}\r
R.layout.sherlock_spinner_dropdown_item);\r
mDirectories.add("/");\r
setContentView(R.layout.files);\r
+ mStorageManager = new FileDataStorageManager(AuthUtils.getCurrentOwnCloudAccount(this), getContentResolver());\r
ActionBar action_bar = getSupportActionBar();\r
action_bar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);\r
action_bar.setDisplayShowTitleEnabled(false);\r
showDialog(0);\r
break;\r
}\r
+ case android.R.id.home: {\r
+ onBackPressed();\r
+ break;\r
+ }\r
+ \r
}\r
return true;\r
}\r
+ \r
+ @Override\r
+ public void onBackPressed(){\r
+ popPath();\r
+ if(mDirectories.getCount() == 0) {\r
+ Intent intent = new Intent(this, LandingActivity.class);\r
+ startActivity(intent);\r
+ return;\r
+ }\r
+ ((FileListFragment) getSupportFragmentManager().findFragmentById(R.id.fileList))\r
+ .onNavigateUp();\r
+ }\r
\r
@Override\r
protected Dialog onCreateDialog(int id) {\r
return true;\r
}\r
\r
- @Override\r
- public void onBackPressed() {\r
- popPath();\r
- if (mDirectories.getCount() == 0) {\r
- super.onBackPressed();\r
- return;\r
- }\r
- ((FileList) getSupportFragmentManager().findFragmentById(R.id.fileList))\r
- .onBackPressed();\r
- }\r
-\r
private class DirectoryCreator implements Runnable {\r
private String mTargetPath;\r
private Account mAccount;\r
\r
\r
}\r
-}
\ No newline at end of file
+}