X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/3e87ca193dd87bb3377441967a70ea9903d802ff..08be3d3433b65d0858dc1503a82ed5a3ba655d36:/src/com/owncloud/android/authentication/AuthenticatorActivity.java diff --git a/src/com/owncloud/android/authentication/AuthenticatorActivity.java b/src/com/owncloud/android/authentication/AuthenticatorActivity.java index b7ec1c65..7b0398e8 100644 --- a/src/com/owncloud/android/authentication/AuthenticatorActivity.java +++ b/src/com/owncloud/android/authentication/AuthenticatorActivity.java @@ -176,6 +176,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity private EditText mUsernameInput; private EditText mPasswordInput; private View mOkButton; + private View mCenteredRefreshButton; private TextView mAuthStatusView; private int mAuthStatusText = 0, mAuthStatusIcon = 0; @@ -250,6 +251,24 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity /// initialize general UI elements initOverallUi(); + + mOkButton = findViewById(R.id.buttonOK); + mOkButton.setOnClickListener(new View.OnClickListener() { + + @Override + public void onClick(View v) { + onOkClick(); + } + }); + + mCenteredRefreshButton = findViewById(R.id.centeredRefreshButton); + mCenteredRefreshButton.setOnClickListener(new View.OnClickListener() { + + @Override + public void onClick(View v) { + checkOcServer(); + } + }); mOkButton = findViewById(R.id.buttonOK); @@ -723,7 +742,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity mOAuthTokenEndpointText.getText().toString().trim()); getServerInfoIntent.putExtra( - OperationsService.EXTRA_OAUTH2_QUERY_PARAMETERS, + OperationsService.EXTRA_OAUTH2_QUERY_PARAMETERS, queryParameters); if (mOperationsServiceBinder != null) { @@ -782,6 +801,8 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity showRefreshButton(false); if (uri.length() != 0) { + uri = stripIndexPhpOrAppsFiles(uri, mHostUrlInput); + // Handle internationalized domain names uri = DisplayUtils.convertIdn(uri, true); @@ -870,10 +891,8 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity * is postponed until it is available. * * IMPORTANT ENTRY POINT 4 - * - * @param view OK button */ - public void onOkClick(View view) { + public void onOkClick() { // this check should be unnecessary if (mServerInfo.mVersion == null || !mServerInfo.mVersion.isVersionValid() || @@ -1126,6 +1145,17 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity return url; } + private String stripIndexPhpOrAppsFiles(String url, EditText mHostUrlInput) { + if (url.endsWith("/index.php")) { + url = url.substring(0, url.lastIndexOf("/index.php")); + mHostUrlInput.setText(url); + } else if (url.contains("/index.php/apps/")) { + url = url.substring(0, url.lastIndexOf("/index.php/apps/")); + mHostUrlInput.setText(url); + } + + return url; + } // TODO remove, if possible private String trimUrlWebdav(String url){ @@ -1356,6 +1386,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity public void onAuthenticatorTaskCallback(RemoteOperationResult result) { mWaitingForOpId = Long.MAX_VALUE; dismissDialog(WAIT_DIALOG_TAG); + mAsyncTask = null; if (result.isSuccess()) { Log_OC.d(TAG, "Successful access - time to save the account");