import android.accounts.Account;\r
import android.accounts.AccountManager;\r
import android.app.Dialog;\r
import android.accounts.Account;\r
import android.accounts.AccountManager;\r
import android.app.Dialog;\r
import android.view.View;\r
import android.view.View.OnFocusChangeListener;\r
import android.view.View.OnTouchListener;\r
import android.view.View;\r
import android.view.View.OnFocusChangeListener;\r
import android.view.View.OnTouchListener;\r
import android.view.inputmethod.EditorInfo;\r
import android.webkit.HttpAuthHandler;\r
import android.webkit.SslErrorHandler;\r
import android.view.inputmethod.EditorInfo;\r
import android.webkit.HttpAuthHandler;\r
import android.webkit.SslErrorHandler;\r
import com.owncloud.android.ui.dialog.SslUntrustedCertDialog.OnSslUntrustedCertListener;\r
import com.owncloud.android.utils.DisplayUtils;\r
\r
import com.owncloud.android.ui.dialog.SslUntrustedCertDialog.OnSslUntrustedCertListener;\r
import com.owncloud.android.utils.DisplayUtils;\r
\r
private EditText mUsernameInput;\r
private EditText mPasswordInput;\r
private View mOkButton;\r
private EditText mUsernameInput;\r
private EditText mPasswordInput;\r
private View mOkButton;\r
private TextView mAuthStatusView;\r
\r
private int mAuthStatusText = 0, mAuthStatusIcon = 0;\r
private TextView mAuthStatusView;\r
\r
private int mAuthStatusText = 0, mAuthStatusIcon = 0;\r
protected void onCreate(Bundle savedInstanceState) {\r
//Log_OC.wtf(TAG, "onCreate init");\r
super.onCreate(savedInstanceState);\r
protected void onCreate(Bundle savedInstanceState) {\r
//Log_OC.wtf(TAG, "onCreate init");\r
super.onCreate(savedInstanceState);\r
+ if (getSupportActionBar() != null) {\r
+ getSupportActionBar().hide();\r
+\r
+ getSupportActionBar().setDisplayHomeAsUpEnabled(false);\r
+ getSupportActionBar().setDisplayShowHomeEnabled(false);\r
+ getSupportActionBar().setDisplayShowTitleEnabled(false);\r
+ }\r
+ mOkButton.setOnClickListener(new View.OnClickListener() {\r
+\r
+ @Override\r
+ public void onClick(View v) {\r
+ onOkClick();\r
+ }\r
+ });\r
+\r
+ mCenteredRefreshButton = findViewById(R.id.centeredRefreshButton);\r
+ mCenteredRefreshButton.setOnClickListener(new View.OnClickListener() {\r
+\r
+ @Override\r
+ public void onClick(View v) {\r
+ checkOcServer();\r
+ }\r
+ });\r
+\r
\r
/// initialize block to be moved to single Fragment to check server and get info about it \r
initServerPreFragment(savedInstanceState);\r
\r
/// initialize block to be moved to single Fragment to check server and get info about it \r
initServerPreFragment(savedInstanceState);\r
if (mAccount != null) {\r
mServerInfo.mBaseUrl = mAccountMgr.getUserData(mAccount, Constants.KEY_OC_BASE_URL);\r
// TODO do next in a setter for mBaseUrl\r
if (mAccount != null) {\r
mServerInfo.mBaseUrl = mAccountMgr.getUserData(mAccount, Constants.KEY_OC_BASE_URL);\r
// TODO do next in a setter for mBaseUrl\r
- mServerInfo.mIsSslConn = mServerInfo.mBaseUrl.startsWith("https://"); \r
- String ocVersion = mAccountMgr.getUserData(mAccount, Constants.KEY_OC_VERSION);\r
- if (ocVersion != null) {\r
- mServerInfo.mVersion = new OwnCloudVersion(ocVersion);\r
- }\r
+ mServerInfo.mIsSslConn = mServerInfo.mBaseUrl.startsWith("https://");\r
+ mServerInfo.mVersion = AccountUtils.getServerVersion(mAccount);\r
} else {\r
mServerInfo.mBaseUrl = getString(R.string.server_url).trim();\r
mServerInfo.mIsSslConn = mServerInfo.mBaseUrl.startsWith("https://");\r
} else {\r
mServerInfo.mBaseUrl = getString(R.string.server_url).trim();\r
mServerInfo.mIsSslConn = mServerInfo.mBaseUrl.startsWith("https://");\r
* intended to defer the processing of the redirection caught in \r
* {@link #onNewIntent(Intent)} until {@link #onResume()} \r
* \r
* intended to defer the processing of the redirection caught in \r
* {@link #onNewIntent(Intent)} until {@link #onResume()} \r
* \r
\r
mHostUrlInput.removeTextChangedListener(mHostUrlInputWatcher);\r
mHostUrlInput.setOnFocusChangeListener(null);\r
\r
mHostUrlInput.removeTextChangedListener(mHostUrlInputWatcher);\r
mHostUrlInput.setOnFocusChangeListener(null);\r
Intent getServerInfoIntent = new Intent();\r
getServerInfoIntent.setAction(OperationsService.ACTION_GET_SERVER_INFO);\r
getServerInfoIntent.putExtra(\r
Intent getServerInfoIntent = new Intent();\r
getServerInfoIntent.setAction(OperationsService.ACTION_GET_SERVER_INFO);\r
getServerInfoIntent.putExtra(\r
- OperationsService.EXTRA_SERVER_URL, \r
- normalizeUrlSuffix(uri)\r
+ OperationsService.EXTRA_SERVER_URL,\r
+ normalizeUrlSuffix(uri)\r
);\r
if (mOperationsServiceBinder != null) {\r
mWaitingForOpId = mOperationsServiceBinder.queueNewOperation(getServerInfoIntent);\r
);\r
if (mOperationsServiceBinder != null) {\r
mWaitingForOpId = mOperationsServiceBinder.queueNewOperation(getServerInfoIntent);\r
// this check should be unnecessary\r
if (mServerInfo.mVersion == null || \r
!mServerInfo.mVersion.isVersionValid() || \r
// this check should be unnecessary\r
if (mServerInfo.mVersion == null || \r
!mServerInfo.mVersion.isVersionValid() || \r
if(url.toLowerCase().endsWith(AccountUtils.WEBDAV_PATH_4_0_AND_LATER)){\r
url = url.substring(0, url.length() - AccountUtils.WEBDAV_PATH_4_0_AND_LATER.length());\r
}\r
if(url.toLowerCase().endsWith(AccountUtils.WEBDAV_PATH_4_0_AND_LATER)){\r
url = url.substring(0, url.length() - AccountUtils.WEBDAV_PATH_4_0_AND_LATER.length());\r
}\r
mServerStatusText = R.string.auth_unknown_error_title;\r
break;\r
case OK_REDIRECT_TO_NON_SECURE_CONNECTION:\r
mServerStatusText = R.string.auth_unknown_error_title;\r
break;\r
case OK_REDIRECT_TO_NON_SECURE_CONNECTION:\r
Log_OC.d(TAG, "Successful access - time to save the account");\r
\r
boolean success = false;\r
Log_OC.d(TAG, "Successful access - time to save the account");\r
\r
boolean success = false;\r
response.putString(AccountManager.KEY_ACCOUNT_TYPE, mAccount.type);\r
\r
if (AccountTypeUtils.getAuthTokenTypeAccessToken(MainApp.getAccountType()).\r
response.putString(AccountManager.KEY_ACCOUNT_TYPE, mAccount.type);\r
\r
if (AccountTypeUtils.getAuthTokenTypeAccessToken(MainApp.getAccountType()).\r
response.putString(AccountManager.KEY_AUTHTOKEN, mAuthToken);\r
// the next line is necessary, notifications are calling directly to the \r
// AuthenticatorActivity to update, without AccountManager intervention\r
response.putString(AccountManager.KEY_AUTHTOKEN, mAuthToken);\r
// the next line is necessary, notifications are calling directly to the \r
// AuthenticatorActivity to update, without AccountManager intervention\r
/// create and save new ownCloud account\r
boolean isOAuth = AccountTypeUtils.\r
getAuthTokenTypeAccessToken(MainApp.getAccountType()).equals(mAuthTokenType);\r
boolean isSaml = AccountTypeUtils.\r
getAuthTokenTypeSamlSessionCookie(MainApp.getAccountType()).equals(mAuthTokenType);\r
\r
/// create and save new ownCloud account\r
boolean isOAuth = AccountTypeUtils.\r
getAuthTokenTypeAccessToken(MainApp.getAccountType()).equals(mAuthTokenType);\r
boolean isSaml = AccountTypeUtils.\r
getAuthTokenTypeSamlSessionCookie(MainApp.getAccountType()).equals(mAuthTokenType);\r
\r
Uri uri = Uri.parse(mServerInfo.mBaseUrl);\r
String username = mUsernameInput.getText().toString().trim();\r
if (isOAuth) {\r
Uri uri = Uri.parse(mServerInfo.mBaseUrl);\r
String username = mUsernameInput.getText().toString().trim();\r
if (isOAuth) {\r
/// add user data to the new account; TODO probably can be done in the last parameter \r
// addAccountExplicitly, or in KEY_USERDATA\r
mAccountMgr.setUserData(\r
/// add user data to the new account; TODO probably can be done in the last parameter \r
// addAccountExplicitly, or in KEY_USERDATA\r
mAccountMgr.setUserData(\r
);\r
mAccountMgr.setUserData(\r
mAccount, Constants.KEY_OC_BASE_URL, mServerInfo.mBaseUrl\r
);\r
mAccountMgr.setUserData(\r
mAccount, Constants.KEY_OC_BASE_URL, mServerInfo.mBaseUrl\r
- * Called when the refresh button in the input field for ownCloud host is clicked.\r
- * \r
- * Performs a new check on the URL in the input field.\r
- * \r
- * @param view Refresh 'button'\r
- */\r
- public void onRefreshClick(View view) {\r
- checkOcServer();\r
- }\r
-\r
-\r
- /**\r
* Called when the eye icon in the password field is clicked.\r
* \r
* Toggles the visibility of the password in the field. \r
* Called when the eye icon in the password field is clicked.\r
* \r
* Toggles the visibility of the password in the field. \r
\r
Intent getUserNameIntent = new Intent();\r
getUserNameIntent.setAction(OperationsService.ACTION_GET_USER_NAME);\r
\r
Intent getUserNameIntent = new Intent();\r
getUserNameIntent.setAction(OperationsService.ACTION_GET_USER_NAME);\r
if (sessionCookie != null && sessionCookie.length() > 0) {\r
Log_OC.d(TAG, "Successful SSO - time to save the account");\r
mAuthToken = sessionCookie;\r
if (sessionCookie != null && sessionCookie.length() > 0) {\r
Log_OC.d(TAG, "Successful SSO - time to save the account");\r
mAuthToken = sessionCookie;\r
Fragment fd = getSupportFragmentManager().findFragmentByTag(SAML_DIALOG_TAG);\r
if (fd != null && fd instanceof DialogFragment) {\r
Dialog d = ((DialogFragment)fd).getDialog();\r
Fragment fd = getSupportFragmentManager().findFragmentByTag(SAML_DIALOG_TAG);\r
if (fd != null && fd instanceof DialogFragment) {\r
Dialog d = ((DialogFragment)fd).getDialog();\r
X509Certificate x509Certificate, SslError error, SslErrorHandler handler\r
) {\r
// Show a dialog with the certificate info\r
X509Certificate x509Certificate, SslError error, SslErrorHandler handler\r
) {\r
// Show a dialog with the certificate info\r
if (x509Certificate == null) {\r
dialog = SslUntrustedCertDialog.newInstanceForEmptySslError(error, handler);\r
} else {\r
if (x509Certificate == null) {\r
dialog = SslUntrustedCertDialog.newInstanceForEmptySslError(error, handler);\r
} else {\r