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.FileListFragment;\r
import eu.alefzero.webdav.WebdavClient;\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
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
break;\r
}\r
case android.R.id.home: {\r
- navigateUp();\r
+ onBackPressed();\r
break;\r
}\r
\r
return true;\r
}\r
\r
- public void navigateUp(){\r
+ @Override\r
+ public void onBackPressed(){\r
popPath();\r
if(mDirectories.getCount() == 0) {\r
Intent intent = new Intent(this, LandingActivity.class);\r
- intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);\r
startActivity(intent);\r
return;\r
}\r
public boolean onNavigationItemSelected(int itemPosition, long itemId) {\r
int i = itemPosition;\r
while (i-- != 0) {\r
- navigateUp();\r
+ onBackPressed();\r
}\r
return true;\r
}\r
\r
\r
}\r
--}
++}