+ protected Dialog onCreateDialog(int id, Bundle args) {\r
+ final AlertDialog.Builder builder = new Builder(this);\r
+ final EditText dirName = new EditText(getBaseContext());\r
+ builder.setView(dirName);\r
+ builder.setTitle(R.string.uploader_info_dirname);\r
+ \r
+ builder.setPositiveButton(R.string.common_ok, new OnClickListener() {\r
+ public void onClick(DialogInterface dialog, int which) {\r
+ String s = dirName.getText().toString();\r
+ if (s.trim().isEmpty()) {\r
+ dialog.cancel();\r
+ return;\r
+ }\r
+ AccountManager am = (AccountManager) getSystemService(ACCOUNT_SERVICE);\r
+ // following account choosing is incorrect and needs to be replaced\r
+ // with some sort of session mechanism\r
+ Account a = am.getAccountsByType(AccountAuthenticator.ACCOUNT_TYPE)[0];\r
+\r
+ String path = "";\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
+ Thread thread = new Thread(new DirectoryCreator(path, a, am));\r
+ thread.start();\r
+ OCFile.createNewFile(getContentResolver(), a, path, 0, 0, 0, "DIR", parent.getFileId()).save();\r
+ \r
+ dialog.dismiss();\r
+ }\r
+ });\r
+ builder.setNegativeButton(R.string.common_cancel, new OnClickListener() {\r
+ public void onClick(DialogInterface dialog, int which) {\r
+ dialog.cancel();\r
+ }\r
+ });\r
+ return builder.create();\r
+ }\r
+ \r
+ @Override\r