X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/99d52af203f63a5dd3d43626f569ac88c5ac9b14..91bc3fdb1eb923053b469b94e5b200482f522010:/src/com/owncloud/android/ui/activity/AuthenticatorActivity.java diff --git a/src/com/owncloud/android/ui/activity/AuthenticatorActivity.java b/src/com/owncloud/android/ui/activity/AuthenticatorActivity.java index a71f65b8..4f4cb96a 100644 --- a/src/com/owncloud/android/ui/activity/AuthenticatorActivity.java +++ b/src/com/owncloud/android/ui/activity/AuthenticatorActivity.java @@ -41,6 +41,7 @@ import android.content.ContentResolver; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; +import android.net.Uri; import android.os.Bundle; import android.os.Handler; import android.preference.PreferenceManager; @@ -222,12 +223,17 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity finish(); } else { - dismissDialog(DIALOG_LOGIN_PROGRESS); + try { + dismissDialog(DIALOG_LOGIN_PROGRESS); + } catch (IllegalArgumentException e) { + // NOTHING TO DO ; can't find out what situation that leads to the exception in this code, but user logs signal that it happens + } TextView tv = (TextView) findViewById(R.id.account_username); tv.setError(message); } } public void onCancelClick(View view) { + setResult(RESULT_CANCELED); finish(); } @@ -246,6 +252,12 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity } continueConnection(prefix); } + + public void onRegisterClick(View view) { + Intent register = new Intent(Intent.ACTION_VIEW, Uri.parse("https://owncloud.com/mobile/new")); + setResult(RESULT_CANCELED); + startActivity(register); + } private void continueConnection(String prefix) { String url = ((TextView) findViewById(R.id.host_URL)).getText() @@ -260,14 +272,19 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity URL uri = null; String webdav_path = AccountUtils.getWebdavPath(mConnChkRunnable .getDiscoveredVersion()); - + if (webdav_path == null) { + onAuthenticationResult(false, getString(R.string.auth_bad_oc_version_title)); + return; + } + try { mBaseUrl = prefix + url; String url_str = prefix + url + webdav_path; uri = new URL(url_str); } catch (MalformedURLException e) { - // should not happen - e.printStackTrace(); + // should never happen + onAuthenticationResult(false, getString(R.string.auth_incorrect_address_title)); + return; } showDialog(DIALOG_LOGIN_PROGRESS); @@ -366,7 +383,6 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity if (uri.length() != 0) { setResultIconAndText(R.drawable.progress_small, R.string.auth_testing_connection); - findViewById(R.id.buttonOK).setEnabled(false); // avoid connect can be clicked if the test was previously passed mConnChkRunnable = new ConnectionCheckerRunnable(uri, this); mConnChkRunnable.setListener(this, mHandler); mAuthThread = new Thread(mConnChkRunnable); @@ -376,6 +392,9 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity View.INVISIBLE); setResultIconAndText(0, 0); } + } else { + // avoids that the 'connect' button can be clicked if the test was previously passed + findViewById(R.id.buttonOK).setEnabled(false); } } else if (view.getId() == R.id.account_password) { ImageView iv = (ImageView) findViewById(R.id.viewPassword);