- * {@inheritDoc}\r
- * \r
- * Necessary to update the contents of the SSL Dialog\r
- * \r
- * TODO move to some common place for all possible untrusted SSL failures\r
- */\r
- @Override\r
- protected void onPrepareDialog(int id, Dialog dialog, Bundle args) {\r
- switch (id) {\r
- case DIALOG_LOGIN_PROGRESS:\r
- case DIALOG_CERT_NOT_SAVED:\r
- case DIALOG_OAUTH2_LOGIN_PROGRESS:\r
- break;\r
- default:\r
- Log_OC.e(TAG, "Incorrect dialog called with id = " + id);\r
- }\r
- }\r
-\r
-\r
- /**\r
- * {@inheritDoc}\r
- */\r
- @Override\r
- protected Dialog onCreateDialog(int id) {\r
- Dialog dialog = null;\r
- switch (id) {\r
- case DIALOG_LOGIN_PROGRESS: {\r
- /// simple progress dialog\r
- ProgressDialog working_dialog = new ProgressDialog(this);\r
- working_dialog.setMessage(getResources().getString(R.string.auth_trying_to_login));\r
- working_dialog.setIndeterminate(true);\r
- working_dialog.setCancelable(true);\r
- working_dialog\r
- .setOnCancelListener(new DialogInterface.OnCancelListener() {\r
- @Override\r
- public void onCancel(DialogInterface dialog) {\r
- /// TODO study if this is enough\r
- Log_OC.i(TAG, "Login canceled");\r
- if (mOperationThread != null) {\r
- mOperationThread.interrupt();\r
- finish();\r
- }\r
- }\r
- });\r
- dialog = working_dialog;\r
- break;\r
- }\r
- case DIALOG_OAUTH2_LOGIN_PROGRESS: {\r
- ProgressDialog working_dialog = new ProgressDialog(this);\r
- working_dialog.setMessage(String.format("Getting authorization")); \r
- working_dialog.setIndeterminate(true);\r
- working_dialog.setCancelable(true);\r
- working_dialog\r
- .setOnCancelListener(new DialogInterface.OnCancelListener() {\r
- @Override\r
- public void onCancel(DialogInterface dialog) {\r
- Log_OC.i(TAG, "Login canceled");\r
- finish();\r
- }\r
- });\r
- dialog = working_dialog;\r
- break;\r
- }\r
- case DIALOG_CERT_NOT_SAVED: {\r
- AlertDialog.Builder builder = new AlertDialog.Builder(this);\r
- builder.setMessage(getResources().getString(R.string.ssl_validator_not_saved));\r
- builder.setCancelable(false);\r
- builder.setPositiveButton(R.string.common_ok, new DialogInterface.OnClickListener() {\r
- @Override\r
- public void onClick(DialogInterface dialog, int which) {\r
- dialog.dismiss();\r
- };\r
- });\r
- dialog = builder.create();\r
- break;\r
- }\r
- default:\r
- Log_OC.e(TAG, "Incorrect dialog called with id = " + id);\r
- }\r
- return dialog;\r
- }\r
-\r
-\r
- /**\r