private TextView mOAuthTokenEndpointText;\r
\r
private boolean mRefreshButtonEnabled;\r
+ \r
+ private boolean mHostUrlInputEnabled;\r
\r
\r
/**\r
mOAuth2Check = (CheckBox) findViewById(R.id.oauth_onOff_check);\r
mOkButton = findViewById(R.id.buttonOK);\r
mAuthStatusLayout = (TextView) findViewById(R.id.auth_status_text); \r
+ \r
+ /// set Host Url Input Enabled\r
+ mHostUrlInputEnabled = getResources().getBoolean(R.bool.show_server_url_input);\r
\r
/// complete label for 'register account' button\r
Button b = (Button) findViewById(R.id.account_register);\r
mAction = getIntent().getByteExtra(EXTRA_ACTION, ACTION_CREATE); \r
mAccount = null;\r
mHostBaseUrl = "";\r
+ if (!mHostUrlInputEnabled)\r
+ {\r
+ mHostUrlInput.setText(getString(R.string.server_url));\r
+ mHostUrlInput.setVisibility(View.GONE);\r
+ checkOcServer();\r
+ }\r
\r
if (savedInstanceState == null) {\r
/// connection state and info\r
\r
private void checkOcServer() {\r
String uri = trimUrlWebdav(mHostUrlInput.getText().toString().trim());\r
+ \r
+ if (!mHostUrlInputEnabled){\r
+ uri = getString(R.string.server_url);\r
+ }\r
+ \r
mServerIsValid = false;\r
mServerIsChecked = false;\r
mOkButton.setEnabled(false);\r
\r
finish();\r
\r
- } else {\r
+ } else if (result.isServerFail() || result.isException()) {\r
+ /// if server fail or exception in authorization, the UI is updated as when a server check failed\r
+ mServerIsChecked = true;\r
+ mServerIsValid = false;\r
+ mIsSslConn = false;\r
+ mOcServerChkOperation = null;\r
+ mDiscoveredVersion = null;\r
+ mHostBaseUrl = normalizeUrl(mHostUrlInput.getText().toString());\r
+\r
+ // update status icon and text\r
+ updateServerStatusIconAndText(result);\r
+ showServerStatus();\r
+ mAuthStatusIcon = 0;\r
+ mAuthStatusText = 0;\r
+ showAuthStatus();\r
+ \r
+ // update input controls state\r
+ showRefreshButton();\r
+ mOkButton.setEnabled(false);\r
+\r
+ // very special case (TODO: move to a common place for all the remote operations) (dangerous here?)\r
+ if (result.getCode() == ResultCode.SSL_RECOVERABLE_PEER_UNVERIFIED) {\r
+ mLastSslUntrustedServerResult = result;\r
+ showDialog(DIALOG_SSL_VALIDATOR); \r
+ }\r
+\r
+ } else { // authorization fail due to client side - probably wrong credentials\r
updateAuthStatusIconAndText(result);\r
showAuthStatus();\r
Log_OC.d(TAG, "Access failed: " + result.getLogMessage());\r