Merge branch 'master' of https://github.com/owncloud/android into material_buttons
[pub/Android/ownCloud.git] / src / com / owncloud / android / authentication / AuthenticatorActivity.java
index e8f42d9..3db9b7a 100644 (file)
@@ -23,9 +23,6 @@
 \r
 package com.owncloud.android.authentication;\r
 \r
-import java.security.cert.X509Certificate;\r
-import java.util.Map;\r
-\r
 import android.accounts.Account;\r
 import android.accounts.AccountManager;\r
 import android.app.Dialog;\r
@@ -93,6 +90,9 @@ import com.owncloud.android.ui.dialog.SslUntrustedCertDialog;
 import com.owncloud.android.ui.dialog.SslUntrustedCertDialog.OnSslUntrustedCertListener;\r
 import com.owncloud.android.utils.DisplayUtils;\r
 \r
+import java.security.cert.X509Certificate;\r
+import java.util.Map;\r
+\r
 /**\r
  * This Activity is used to add an ownCloud account to the App\r
  */\r
@@ -176,6 +176,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
     private EditText mUsernameInput;\r
     private EditText mPasswordInput;\r
     private View mOkButton;\r
+    private View mCenteredRefreshButton;\r
     private TextView mAuthStatusView;\r
 \r
     private int mAuthStatusText = 0, mAuthStatusIcon = 0;\r
@@ -250,8 +251,43 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
         \r
         /// initialize general UI elements\r
         initOverallUi();\r
+\r
+        mOkButton = findViewById(R.id.buttonOK);\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
         mOkButton = findViewById(R.id.buttonOK);\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
@@ -683,7 +719,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
         \r
         mHostUrlInput.removeTextChangedListener(mHostUrlInputWatcher);\r
         mHostUrlInput.setOnFocusChangeListener(null);\r
-        \r
+\r
         super.onPause();\r
     }\r
     \r
@@ -792,8 +828,8 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
             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
@@ -870,10 +906,8 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
      * is postponed until it is available.\r
      * \r
      * IMPORTANT ENTRY POINT 4\r
-     * \r
-     * @param view      OK button\r
      */\r
-    public void onOkClick(View view) {\r
+    public void onOkClick() {\r
         // this check should be unnecessary\r
         if (mServerInfo.mVersion == null || \r
                 !mServerInfo.mVersion.isVersionValid()  || \r
@@ -1146,7 +1180,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
 \r
         switch (result.getCode()) {\r
         case OK_SSL:\r
-            mServerStatusIcon = android.R.drawable.ic_secure;\r
+            mServerStatusIcon = R.drawable.ic_lock;\r
             mServerStatusText = R.string.auth_secure_connection;\r
             break;\r
 \r
@@ -1157,7 +1191,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
                 mServerStatusIcon = R.drawable.ic_ok;\r
             } else {\r
                 mServerStatusText = R.string.auth_nossl_plain_ok_title;\r
-                mServerStatusIcon = android.R.drawable.ic_partial_secure;\r
+                mServerStatusIcon = R.drawable.ic_lock_open;\r
             }\r
             break;\r
 \r
@@ -1207,7 +1241,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
             mServerStatusText = R.string.auth_unknown_error_title;\r
             break;\r
         case OK_REDIRECT_TO_NON_SECURE_CONNECTION:\r
-            mServerStatusIcon = android.R.drawable.ic_partial_secure;\r
+            mServerStatusIcon = R.drawable.ic_lock_open;\r
             mServerStatusText = R.string.auth_redirect_non_secure_connection_title;\r
             break;\r
         default:\r
@@ -1227,7 +1261,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
 \r
         switch (result.getCode()) {\r
         case OK_SSL:\r
-            mAuthStatusIcon = android.R.drawable.ic_secure;\r
+            mAuthStatusIcon = R.drawable.ic_lock;\r
             mAuthStatusText = R.string.auth_secure_connection;\r
             break;\r
 \r
@@ -1238,7 +1272,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
                 mAuthStatusIcon = R.drawable.ic_ok;\r
             } else {\r
                 mAuthStatusText = R.string.auth_nossl_plain_ok_title;\r
-                mAuthStatusIcon = android.R.drawable.ic_partial_secure;\r
+                mAuthStatusIcon = R.drawable.ic_lock_open;\r
             }\r
             break;\r
 \r
@@ -1607,18 +1641,6 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
     }\r
 \r
     /**\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