import android.app.AlertDialog;\r
import android.app.Dialog;\r
import android.app.ProgressDialog;\r
-import android.content.ContentResolver;\r
import android.content.DialogInterface;\r
import android.content.Intent;\r
import android.content.SharedPreferences;\r
import android.widget.TextView.OnEditorActionListener;\r
\r
import com.actionbarsherlock.app.SherlockDialogFragment;\r
-import com.owncloud.android.Log_OC;\r
import com.owncloud.android.MainApp;\r
import com.owncloud.android.R;\r
import com.owncloud.android.authentication.SsoWebViewClient.SsoWebViewClientListener;\r
import com.owncloud.android.oc_framework.accounts.OwnCloudAccount;\r
import com.owncloud.android.oc_framework.network.webdav.OwnCloudClientFactory;\r
import com.owncloud.android.oc_framework.network.webdav.WebdavClient;\r
-import com.owncloud.android.operations.ExistenceCheckOperation;\r
import com.owncloud.android.operations.OAuth2GetAccessToken;\r
import com.owncloud.android.oc_framework.operations.OnRemoteOperationListener;\r
import com.owncloud.android.operations.OwnCloudServerCheckOperation;\r
import com.owncloud.android.oc_framework.operations.RemoteOperation;\r
import com.owncloud.android.oc_framework.operations.RemoteOperationResult;\r
import com.owncloud.android.oc_framework.operations.RemoteOperationResult.ResultCode;\r
+import com.owncloud.android.oc_framework.operations.remote.ExistenceCheckRemoteOperation;\r
import com.owncloud.android.ui.dialog.SamlWebViewDialog;\r
import com.owncloud.android.ui.dialog.SslValidatorDialog;\r
import com.owncloud.android.ui.dialog.SslValidatorDialog.OnSslValidatorListener;\r
+import com.owncloud.android.utils.Log_OC;\r
import com.owncloud.android.oc_framework.utils.OwnCloudVersion;\r
\r
-\r
/**\r
* This Activity is used to add an ownCloud account to the App\r
* \r
private final Handler mHandler = new Handler();\r
private Thread mOperationThread;\r
private OwnCloudServerCheckOperation mOcServerChkOperation;\r
- private ExistenceCheckOperation mAuthCheckOperation;\r
+ private ExistenceCheckRemoteOperation mAuthCheckOperation;\r
private RemoteOperationResult mLastSslUntrustedServerResult;\r
\r
private Uri mNewCapturedUriFromOAuth2Redirection;\r
/// set Host Url Input Enabled\r
mHostUrlInputEnabled = getResources().getBoolean(R.bool.show_server_url_input);\r
\r
-\r
- /// complete label for 'register account' button\r
- Button b = (Button) findViewById(R.id.account_register);\r
- if (b != null) {\r
- b.setText(String.format(getString(R.string.auth_register), getString(R.string.app_name)));\r
+ /// set visibility of link for new users\r
+ boolean accountRegisterVisibility = getResources().getBoolean(R.bool.show_welcome_link);\r
+ Button welcomeLink = (Button) findViewById(R.id.welcome_link);\r
+ if (welcomeLink != null) {\r
+ if (accountRegisterVisibility) {\r
+ welcomeLink.setVisibility(View.VISIBLE);\r
+ welcomeLink.setText(String.format(getString(R.string.auth_register), getString(R.string.app_name))); \r
+ } else {\r
+ findViewById(R.id.welcome_link).setVisibility(View.GONE);\r
+ }\r
}\r
\r
/// initialization\r
showDialog(DIALOG_LOGIN_PROGRESS);\r
\r
/// test credentials accessing the root folder\r
- mAuthCheckOperation = new ExistenceCheckOperation("", this, false);\r
+ mAuthCheckOperation = new ExistenceCheckRemoteOperation("", this, false);\r
WebdavClient client = OwnCloudClientFactory.createOwnCloudClient(Uri.parse(mHostBaseUrl + webdav_path), this, true);\r
client.setBasicCredentials(username, password);\r
mOperationThread = mAuthCheckOperation.execute(client, this, mHandler);\r
String webdav_path = AccountUtils.getWebdavPath(mDiscoveredVersion, mAuthTokenType);\r
\r
/// test credentials accessing the root folder\r
- mAuthCheckOperation = new ExistenceCheckOperation("", this, false);\r
+ mAuthCheckOperation = new ExistenceCheckRemoteOperation("", this, false);\r
WebdavClient client = OwnCloudClientFactory.createOwnCloudClient(Uri.parse(mHostBaseUrl + webdav_path), this, false);\r
mOperationThread = mAuthCheckOperation.execute(client, this, mHandler);\r
\r
} else if (operation instanceof OAuth2GetAccessToken) {\r
onGetOAuthAccessTokenFinish((OAuth2GetAccessToken)operation, result);\r
\r
- } else if (operation instanceof ExistenceCheckOperation) {\r
+ } else if (operation instanceof ExistenceCheckRemoteOperation) {\r
if (AccountTypeUtils.getAuthTokenTypeSamlSessionCookie(MainApp.getAccountType()).equals(mAuthTokenType)) {\r
onSamlBasedFederatedSingleSignOnAuthorizationStart(operation, result);\r
\r
} else {\r
- onAuthorizationCheckFinish((ExistenceCheckOperation)operation, result);\r
+ onAuthorizationCheckFinish((ExistenceCheckRemoteOperation)operation, result);\r
}\r
}\r
}\r
/// time to test the retrieved access token on the ownCloud server\r
mAuthToken = ((OAuth2GetAccessToken)operation).getResultTokenMap().get(OAuth2Constants.KEY_ACCESS_TOKEN);\r
Log_OC.d(TAG, "Got ACCESS TOKEN: " + mAuthToken);\r
- mAuthCheckOperation = new ExistenceCheckOperation("", this, false);\r
+ mAuthCheckOperation = new ExistenceCheckRemoteOperation("", this, false);\r
WebdavClient client = OwnCloudClientFactory.createOwnCloudClient(Uri.parse(mHostBaseUrl + webdav_path), this, true);\r
client.setBearerCredentials(mAuthToken);\r
mAuthCheckOperation.execute(client, this, mHandler);\r
* @param operation Access check performed.\r
* @param result Result of the operation.\r
*/\r
- private void onAuthorizationCheckFinish(ExistenceCheckOperation operation, RemoteOperationResult result) {\r
+ private void onAuthorizationCheckFinish(ExistenceCheckRemoteOperation operation, RemoteOperationResult result) {\r
try {\r
dismissDialog(DIALOG_LOGIN_PROGRESS);\r
} catch (IllegalArgumentException e) {\r
setAccountAuthenticatorResult(intent.getExtras());\r
setResult(RESULT_OK, intent);\r
\r
- /// immediately request for the synchronization of the new account\r
- Bundle bundle = new Bundle();\r
- bundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);\r
- ContentResolver.requestSync(mAccount, MainApp.getAuthTokenType(), bundle);\r
- syncAccount();\r
-// Bundle bundle = new Bundle();\r
-// bundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);\r
-// ContentResolver.requestSync(mAccount, MainApp.getAuthTokenType(), bundle);\r
return true;\r
}\r
}\r
* @param view 'Account register' button\r
*/\r
public void onRegisterClick(View view) {\r
- Intent register = new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.url_account_register)));\r
+ Intent register = new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.welcome_link_url)));\r
setResult(RESULT_CANCELED);\r
startActivity(register);\r
}\r
mAuthMessage.setVisibility(View.GONE);\r
}\r
\r
- private void syncAccount(){\r
- /// immediately request for the synchronization of the new account\r
- Bundle bundle = new Bundle();\r
- bundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);\r
- ContentResolver.requestSync(mAccount, MainApp.getAuthTokenType(), bundle);\r
- }\r
- \r
@Override\r
public boolean onTouchEvent(MotionEvent event) {\r
if (AccountTypeUtils.getAuthTokenTypeSamlSessionCookie(MainApp.getAccountType()).equals(mAuthTokenType) &&\r