X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/30c2ede8e5334cb26b7ad0fa69b7a254fab5afc5..6e43d84b17a15b934989d0b71c1ac795186f26b4:/src/eu/alefzero/owncloud/ui/activity/FileDisplayActivity.java diff --git a/src/eu/alefzero/owncloud/ui/activity/FileDisplayActivity.java b/src/eu/alefzero/owncloud/ui/activity/FileDisplayActivity.java index 6c3f2a88..5ae763cc 100644 --- a/src/eu/alefzero/owncloud/ui/activity/FileDisplayActivity.java +++ b/src/eu/alefzero/owncloud/ui/activity/FileDisplayActivity.java @@ -45,8 +45,10 @@ import com.actionbarsherlock.view.MenuItem; import eu.alefzero.owncloud.R; import eu.alefzero.owncloud.authenticator.AccountAuthenticator; import eu.alefzero.owncloud.authenticator.AuthUtils; +import eu.alefzero.owncloud.datamodel.DataStorageManager; +import eu.alefzero.owncloud.datamodel.FileDataStorageManager; import eu.alefzero.owncloud.datamodel.OCFile; -import eu.alefzero.owncloud.ui.fragment.FileList; +import eu.alefzero.owncloud.ui.fragment.FileListFragment; import eu.alefzero.webdav.WebdavClient; /** @@ -59,6 +61,7 @@ import eu.alefzero.webdav.WebdavClient; public class FileDisplayActivity extends SherlockFragmentActivity implements OnNavigationListener { private ArrayAdapter mDirectories; + private DataStorageManager mStorageManager; private static final int DIALOG_CHOOSE_ACCOUNT = 0; @@ -78,6 +81,7 @@ public class FileDisplayActivity extends SherlockFragmentActivity implements final Account a = AuthUtils.getCurrentOwnCloudAccount(this); builder.setView(dirName); builder.setTitle(R.string.uploader_info_dirname); + dirName.setTextColor(R.color.setup_text_typed); builder.setPositiveButton(R.string.common_ok, new OnClickListener() { public void onClick(DialogInterface dialog, int which) { @@ -91,12 +95,15 @@ public class FileDisplayActivity extends SherlockFragmentActivity implements for (int i = mDirectories.getCount() - 2; i >= 0; --i) { path += "/" + mDirectories.getItem(i); } - OCFile parent = new OCFile(getContentResolver(), a, path + "/"); - path += "/" + s + "/"; + OCFile parent = mStorageManager.getFileByPath(path + "/"); + path += s + "/"; Thread thread = new Thread(new DirectoryCreator(path, a)); thread.start(); - OCFile.createNewFile(getContentResolver(), a, path, 0, 0, 0, - "DIR", parent.getFileId()).save(); + + OCFile new_file = new OCFile(path); + new_file.setMimetype("DIR"); + new_file.setParentId(parent.getParentId()); + mStorageManager.saveFile(new_file); dialog.dismiss(); } @@ -117,6 +124,7 @@ public class FileDisplayActivity extends SherlockFragmentActivity implements R.layout.sherlock_spinner_dropdown_item); mDirectories.add("/"); setContentView(R.layout.files); + mStorageManager = new FileDataStorageManager(AuthUtils.getCurrentOwnCloudAccount(this), getContentResolver()); ActionBar action_bar = getSupportActionBar(); action_bar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); action_bar.setDisplayShowTitleEnabled(false); @@ -136,9 +144,26 @@ public class FileDisplayActivity extends SherlockFragmentActivity implements showDialog(0); break; } + case android.R.id.home: { + onBackPressed(); + break; + } + } return true; } + + @Override + public void onBackPressed(){ + popPath(); + if(mDirectories.getCount() == 0) { + Intent intent = new Intent(this, LandingActivity.class); + startActivity(intent); + return; + } + ((FileListFragment) getSupportFragmentManager().findFragmentById(R.id.fileList)) + .onNavigateUp(); + } @Override protected Dialog onCreateDialog(int id) { @@ -195,17 +220,6 @@ public class FileDisplayActivity extends SherlockFragmentActivity implements return true; } - @Override - public void onBackPressed() { - popPath(); - if (mDirectories.getCount() == 0) { - super.onBackPressed(); - return; - } - ((FileList) getSupportFragmentManager().findFragmentById(R.id.fileList)) - .onBackPressed(); - } - private class DirectoryCreator implements Runnable { private String mTargetPath; private Account mAccount; @@ -265,4 +279,4 @@ public class FileDisplayActivity extends SherlockFragmentActivity implements } -} \ No newline at end of file +}