+ break;\r
+ }\r
+ case DIALOG_CREATE_DIR: {\r
+ builder = new Builder(this);\r
+ final EditText dirNameInput = new EditText(getBaseContext());\r
+ final Account a = AccountUtils.getCurrentOwnCloudAccount(this);\r
+ builder.setView(dirNameInput);\r
+ builder.setTitle(R.string.uploader_info_dirname);\r
+ int typed_color = getResources().getColor(R.color.setup_text_typed);\r
+ dirNameInput.setTextColor(typed_color);\r
+ builder.setPositiveButton(android.R.string.ok,\r
+ new OnClickListener() {\r
+ public void onClick(DialogInterface dialog, int which) {\r
+ String directoryName = dirNameInput.getText().toString();\r
+ if (directoryName.trim().length() == 0) {\r
+ dialog.cancel();\r
+ return;\r
+ }\r
+ \r
+ // Figure out the path where the dir needs to be created\r
+ String path = FileDisplayActivity.this.mCurrentDir.getRemotePath();\r
+ \r
+ // Create directory\r
+ path += directoryName + "/";\r
+ Thread thread = new Thread(new DirectoryCreator(path, a));\r
+ thread.start();\r
+ \r
+ // Save new directory in local database\r
+ OCFile newDir = new OCFile(path);\r
+ newDir.setMimetype("DIR");\r
+ newDir.setParentId(mCurrentDir.getFileId());\r
+ mStorageManager.saveFile(newDir);\r
+ \r
+ // Display the new folder right away\r
+ dialog.dismiss();\r
+ mFileList.listDirectory(mCurrentDir);\r
+ }\r
+ });\r
+ builder.setNegativeButton(R.string.common_cancel,\r
+ new OnClickListener() {\r
+ public void onClick(DialogInterface dialog, int which) {\r
+ dialog.cancel();\r
+ }\r
+ });\r
+ dialog = builder.create();\r
+ break;\r
+ }\r
+ default:\r
+ dialog = null;\r
+ }\r
+ \r
+ return dialog;\r
+ }\r
+\r
+ \r
+ /**\r
+ * Responds to the "There are no ownCloud Accounts setup" dialog\r
+ * TODO: Dialog is 100% useless -> Remove\r
+ */\r
+ @Override\r
+ public void onClick(DialogInterface dialog, int which) {\r
+ // In any case - we won't need it anymore\r
+ dialog.dismiss();\r
+ switch (which) {\r
+ case DialogInterface.BUTTON_POSITIVE:\r
+ Intent intent = new Intent("android.settings.ADD_ACCOUNT_SETTINGS");\r
+ intent.putExtra("authorities",\r
+ new String[] { AccountAuthenticator.AUTH_TOKEN_TYPE });\r
+ startActivity(intent);\r
+ break;\r
+ case DialogInterface.BUTTON_NEGATIVE:\r
+ finish();\r