Merge pull request #324 from owncloud/last_minute_release-1.5.2
[pub/Android/ownCloud.git] / src / com / owncloud / android / authentication / AuthenticatorActivity.java
index a656873..85f4914 100644 (file)
@@ -23,7 +23,6 @@ import android.accounts.AccountManager;
 import android.app.AlertDialog;\r
 import android.app.Dialog;\r
 import android.app.ProgressDialog;\r
 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.content.DialogInterface;\r
 import android.content.Intent;\r
 import android.content.SharedPreferences;\r
@@ -51,7 +50,6 @@ import android.widget.TextView;
 import android.widget.TextView.OnEditorActionListener;\r
 \r
 import com.actionbarsherlock.app.SherlockDialogFragment;\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.MainApp;\r
 import com.owncloud.android.R;\r
 import com.owncloud.android.authentication.SsoWebViewClient.SsoWebViewClientListener;\r
@@ -69,9 +67,9 @@ import com.owncloud.android.oc_framework.operations.RemoteOperationResult.Result
 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.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
 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
 /**\r
  * This Activity is used to add an ownCloud account to the App\r
  * \r
@@ -194,11 +192,16 @@ implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
         /// set Host Url Input Enabled\r
         mHostUrlInputEnabled = getResources().getBoolean(R.bool.show_server_url_input);\r
         \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
         }\r
 \r
         /// initialization\r
@@ -1272,14 +1275,6 @@ implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
             setAccountAuthenticatorResult(intent.getExtras());\r
             setResult(RESULT_OK, intent);\r
     \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
             return true;\r
         }\r
     }\r
@@ -1398,7 +1393,7 @@ implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
      * @param view      'Account register' button\r
      */\r
     public void onRegisterClick(View view) {\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
         setResult(RESULT_CANCELED);\r
         startActivity(register);\r
     }\r
@@ -1649,13 +1644,6 @@ implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
         mAuthMessage.setVisibility(View.GONE);\r
     }\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
     @Override\r
     public boolean onTouchEvent(MotionEvent event) {\r
         if (AccountTypeUtils.getAuthTokenTypeSamlSessionCookie(MainApp.getAccountType()).equals(mAuthTokenType) &&\r