瀏覽代碼

OC-461: Add check server button. OC-394

masensio 12 年之前
父節點
當前提交
b52f0484b4

+ 8 - 0
res/layout-land/account_setup.xml

@@ -54,6 +54,14 @@
 			    android:gravity="center"
 			    android:orientation="vertical"
 			    android:padding="8dp" >
+
+				<Button
+				    android:id="@+id/checkServerButton"
+				    android:layout_width="wrap_content"
+				    android:layout_height="wrap_content"
+				    android:layout_gravity="center_horizontal"
+				    android:text="@string/auth_check_server"
+				    android:visibility="gone" />
 		
 				<EditText
 					android:id="@+id/hostUrlInput"

+ 8 - 0
res/layout/account_setup.xml

@@ -40,6 +40,14 @@
             android:layout_marginTop="10dp"
             android:src="@drawable/logo" />
 
+        <Button
+            android:id="@+id/checkServerButton"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center_horizontal"
+            android:text="@string/auth_check_server"
+            android:visibility="gone" />
+
 		<EditText
 			android:id="@+id/hostUrlInput"
 			android:layout_width="match_parent"

+ 1 - 1
res/values/branding.xml

@@ -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>

+ 1 - 0
res/values/strings.xml

@@ -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>

+ 25 - 0
src/com/owncloud/android/authentication/AuthenticatorActivity.java

@@ -54,6 +54,7 @@ import android.text.TextWatcher;
 import android.view.KeyEvent;
 import android.view.MotionEvent;
 import android.view.View;
+import android.view.View.OnClickListener;
 import android.view.View.OnFocusChangeListener;
 import android.view.View.OnTouchListener;
 import android.view.Window;
@@ -131,6 +132,7 @@ implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
     private byte mAction;
     private Account mAccount;
 
+    private Button mCheckServerButton;
     private EditText mHostUrlInput;
     private EditText mUsernameInput;
     private EditText mPasswordInput;
@@ -159,6 +161,7 @@ implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
 
         /// set view and get references to view elements
         setContentView(R.layout.account_setup);
+        mCheckServerButton = (Button) findViewById(R.id.checkServerButton);
         mHostUrlInput = (EditText) findViewById(R.id.hostUrlInput);
         mUsernameInput = (EditText) findViewById(R.id.account_username);
         mPasswordInput = (EditText) findViewById(R.id.account_password);
@@ -170,6 +173,7 @@ implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
         
         /// set Host Url Input Enabled
         mHostUrlInputEnabled = getResources().getBoolean(R.bool.show_server_url_input);
+        
 
         /// complete label for 'register account' button
         Button b = (Button) findViewById(R.id.account_register);
@@ -183,10 +187,23 @@ implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
         mAction = getIntent().getByteExtra(EXTRA_ACTION, ACTION_CREATE); 
         mAccount = null;
         mHostBaseUrl = "";
+        
+        // URL Branding
         if (!mHostUrlInputEnabled)
         {
             mHostUrlInput.setText(getString(R.string.server_url));
             mHostUrlInput.setVisibility(View.GONE);
+            
+            mCheckServerButton.setVisibility(View.VISIBLE);
+            mCheckServerButton.setOnClickListener(new OnClickListener() {
+                
+                @Override
+                public void onClick(View v) {
+                    checkOcServer();
+                    
+                }
+            });
+            
             checkOcServer();
         }
 
@@ -1212,11 +1229,19 @@ implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
     private void showRefreshButton() {
         mHostUrlInput.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_action_refresh_black, 0);
         mRefreshButtonEnabled = true;
+        
+        if (!mHostUrlInputEnabled){
+           mCheckServerButton.setVisibility(View.VISIBLE); 
+        }
     }
 
     private void hideRefreshButton() {
         mHostUrlInput.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
         mRefreshButtonEnabled = false;
+        
+        if (!mHostUrlInputEnabled){
+            mCheckServerButton.setVisibility(View.INVISIBLE); 
+        }
     }
 
     /**