OC-461: Add check server button. OC-394
authormasensio <masensio@solidgear.es>
Wed, 26 Jun 2013 16:50:08 +0000 (18:50 +0200)
committermasensio <masensio@solidgear.es>
Wed, 26 Jun 2013 16:50:08 +0000 (18:50 +0200)
res/layout-land/account_setup.xml
res/layout/account_setup.xml
res/values/branding.xml
res/values/strings.xml
src/com/owncloud/android/authentication/AuthenticatorActivity.java

index dea86cd..5aa23e5 100644 (file)
                            android:gravity="center"\r
                            android:orientation="vertical"\r
                            android:padding="8dp" >\r
+\r
+                               <Button\r
+                                   android:id="@+id/checkServerButton"\r
+                                   android:layout_width="wrap_content"\r
+                                   android:layout_height="wrap_content"\r
+                                   android:layout_gravity="center_horizontal"\r
+                                   android:text="@string/auth_check_server"\r
+                                   android:visibility="gone" />\r
                \r
                                <EditText\r
                                        android:id="@+id/hostUrlInput"\r
index a218fa9..b4c1b63 100644 (file)
             android:layout_marginTop="10dp"\r
             android:src="@drawable/logo" />\r
 \r
+        <Button\r
+            android:id="@+id/checkServerButton"\r
+            android:layout_width="wrap_content"\r
+            android:layout_height="wrap_content"\r
+            android:layout_gravity="center_horizontal"\r
+            android:text="@string/auth_check_server"\r
+            android:visibility="gone" />\r
+\r
                <EditText\r
                        android:id="@+id/hostUrlInput"\r
                        android:layout_width="match_parent"\r
index 29343b7..9d6f54f 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
-    <string name="server_url">"http://beta.owncloud.com/owncloud/"</string>
+    <string name="server_url">"http://beta.owncloud.com/owncloud"</string>
     <bool name="show_server_url_input">false</bool>
 </resources>
index 708fbfb..d22c1b1 100644 (file)
@@ -48,6 +48,7 @@
     <string name="prefs_log_summary_history">This shows the recorded logs</string>
     <string name="prefs_log_delete_history_button">Delete History</string>
     
+    <string name="auth_check_server">Check Server</string>
     <string name="auth_host_url">Server address</string>
     <string name="auth_username">Username</string>
     <string name="auth_password">Password</string>
index ce704ca..b6ead82 100644 (file)
@@ -54,6 +54,7 @@ import android.text.TextWatcher;
 import android.view.KeyEvent;\r
 import android.view.MotionEvent;\r
 import android.view.View;\r
+import android.view.View.OnClickListener;\r
 import android.view.View.OnFocusChangeListener;\r
 import android.view.View.OnTouchListener;\r
 import android.view.Window;\r
@@ -131,6 +132,7 @@ implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
     private byte mAction;\r
     private Account mAccount;\r
 \r
+    private Button mCheckServerButton;\r
     private EditText mHostUrlInput;\r
     private EditText mUsernameInput;\r
     private EditText mPasswordInput;\r
@@ -159,6 +161,7 @@ implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
 \r
         /// set view and get references to view elements\r
         setContentView(R.layout.account_setup);\r
+        mCheckServerButton = (Button) findViewById(R.id.checkServerButton);\r
         mHostUrlInput = (EditText) findViewById(R.id.hostUrlInput);\r
         mUsernameInput = (EditText) findViewById(R.id.account_username);\r
         mPasswordInput = (EditText) findViewById(R.id.account_password);\r
@@ -170,6 +173,7 @@ implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
         \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
@@ -183,10 +187,23 @@ implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
         mAction = getIntent().getByteExtra(EXTRA_ACTION, ACTION_CREATE); \r
         mAccount = null;\r
         mHostBaseUrl = "";\r
+        \r
+        // URL Branding\r
         if (!mHostUrlInputEnabled)\r
         {\r
             mHostUrlInput.setText(getString(R.string.server_url));\r
             mHostUrlInput.setVisibility(View.GONE);\r
+            \r
+            mCheckServerButton.setVisibility(View.VISIBLE);\r
+            mCheckServerButton.setOnClickListener(new OnClickListener() {\r
+                \r
+                @Override\r
+                public void onClick(View v) {\r
+                    checkOcServer();\r
+                    \r
+                }\r
+            });\r
+            \r
             checkOcServer();\r
         }\r
 \r
@@ -1212,11 +1229,19 @@ implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
     private void showRefreshButton() {\r
         mHostUrlInput.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_action_refresh_black, 0);\r
         mRefreshButtonEnabled = true;\r
+        \r
+        if (!mHostUrlInputEnabled){\r
+           mCheckServerButton.setVisibility(View.VISIBLE); \r
+        }\r
     }\r
 \r
     private void hideRefreshButton() {\r
         mHostUrlInput.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);\r
         mRefreshButtonEnabled = false;\r
+        \r
+        if (!mHostUrlInputEnabled){\r
+            mCheckServerButton.setVisibility(View.INVISIBLE); \r
+        }\r
     }\r
 \r
     /**\r