Merge branch 'develop' into branding_configurable_URL_input_field
authorDavid A. Velasco <dvelasco@solidgear.es>
Fri, 5 Jul 2013 09:52:24 +0000 (11:52 +0200)
committerDavid A. Velasco <dvelasco@solidgear.es>
Fri, 5 Jul 2013 09:52:24 +0000 (11:52 +0200)
res/layout-land/account_setup.xml
res/layout/account_setup.xml
res/values/branding.xml [new file with mode: 0644]
res/values/strings.xml
src/com/owncloud/android/authentication/AuthenticatorActivity.java

index d3622be..b18b815 100644 (file)
                            android:gravity="center"\r
                            android:orientation="vertical"\r
                            android:padding="8dp" >\r
+                           \r
+                               <Button\r
+                                   android:id="@+id/centeredRefreshButton"\r
+                                   android:layout_width="wrap_content"\r
+                                   android:layout_height="wrap_content"\r
+                                   android:layout_gravity="center_horizontal"\r
+                       android:onClick="onRefreshClick"\r
+                                   android:text="@string/auth_check_server"\r
+                                   android:visibility="gone" />\r
                \r
                            <FrameLayout \r
+                               android:id="@+id/hostUrlFrame"\r
                                        android:layout_width="match_parent"\r
                                        android:layout_height="wrap_content"\r
                                >\r
@@ -71,7 +81,7 @@
                                                <requestFocus />\r
                                        </EditText>\r
                                        <ImageButton\r
-                                           android:id="@+id/refeshButton"\r
+                                           android:id="@+id/embeddedRefreshButton"\r
                                            android:layout_width="48dp"\r
                                            android:layout_height="48dp"\r
                                            android:layout_gravity="center_vertical|right"\r
index 1c7921d..14dd20d 100644 (file)
             android:layout_marginTop="10dp"\r
             android:src="@drawable/logo" />\r
 \r
+        <Button\r
+            android:id="@+id/centeredRefreshButton"\r
+            android:layout_width="wrap_content"\r
+            android:layout_height="wrap_content"\r
+            android:layout_gravity="center_horizontal"\r
+            android:onClick="onRefreshClick"\r
+            android:text="@string/auth_check_server"\r
+            android:visibility="gone" />\r
+\r
            <FrameLayout \r
+               android:id="@+id/hostUrlFrame"\r
                        android:layout_width="match_parent"\r
                        android:layout_height="wrap_content"\r
                >\r
@@ -56,7 +66,7 @@
                                <requestFocus />\r
                        </EditText>\r
                        <ImageButton\r
-                           android:id="@+id/refeshButton"\r
+                           android:id="@+id/embeddedRefreshButton"\r
                            android:layout_width="48dp"\r
                            android:layout_height="48dp"\r
                            android:layout_gravity="center_vertical|right"\r
diff --git a/res/values/branding.xml b/res/values/branding.xml
new file mode 100644 (file)
index 0000000..9d6f54f
--- /dev/null
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <string name="server_url">"http://beta.owncloud.com/owncloud"</string>
+    <bool name="show_server_url_input">false</bool>
+</resources>
index 7e4ec93..8c273bd 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 dabe98e..18226a5 100644 (file)
@@ -60,7 +60,6 @@ import android.view.inputmethod.EditorInfo;
 import android.widget.CheckBox;\r
 import android.widget.EditText;\r
 import android.widget.Button;\r
-import android.widget.ImageButton;\r
 import android.widget.TextView;\r
 import android.widget.Toast;\r
 import android.widget.TextView.OnEditorActionListener;\r
@@ -133,7 +132,7 @@ implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
     private Account mAccount;\r
 \r
     private EditText mHostUrlInput;\r
-    private ImageButton mRefreshButton;\r
+    private View mRefreshButton;\r
     private EditText mUsernameInput;\r
     private EditText mPasswordInput;\r
     private CheckBox mOAuth2Check;\r
@@ -145,6 +144,8 @@ implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
     private TextView mOAuthTokenEndpointText;\r
     \r
     private boolean mRefreshButtonEnabled;\r
+    \r
+    private boolean mHostUrlInputEnabled;\r
 \r
 \r
     /**\r
@@ -160,7 +161,6 @@ implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
         /// set view and get references to view elements\r
         setContentView(R.layout.account_setup);\r
         mHostUrlInput = (EditText) findViewById(R.id.hostUrlInput);\r
-        mRefreshButton = (ImageButton) findViewById(R.id.refeshButton);\r
         mUsernameInput = (EditText) findViewById(R.id.account_username);\r
         mPasswordInput = (EditText) findViewById(R.id.account_password);\r
         mOAuthAuthEndpointText = (TextView)findViewById(R.id.oAuthEntryPoint_1);\r
@@ -168,6 +168,10 @@ implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
         mOAuth2Check = (CheckBox) findViewById(R.id.oauth_onOff_check);\r
         mOkButton = findViewById(R.id.buttonOK);\r
         mAuthStatusLayout = (TextView) findViewById(R.id.auth_status_text); \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
@@ -182,6 +186,18 @@ implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
         mAccount = null;\r
         mHostBaseUrl = "";\r
         boolean refreshButtonEnabled = false;\r
+        \r
+        // URL input configuration applied\r
+        if (!mHostUrlInputEnabled)\r
+        {\r
+            mHostUrlInput.setText(getString(R.string.server_url));\r
+            findViewById(R.id.hostUrlFrame).setVisibility(View.GONE);\r
+            \r
+            mRefreshButton = findViewById(R.id.centeredRefreshButton);\r
+\r
+        } else {\r
+            mRefreshButton = findViewById(R.id.embeddedRefreshButton);\r
+        }\r
 \r
         if (savedInstanceState == null) {\r
             /// connection state and info\r
@@ -211,7 +227,7 @@ implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
             changeViewByOAuth2Check(oAuthRequired);\r
             mJustCreated = true;\r
             \r
-            if (mAction == ACTION_UPDATE_TOKEN) {\r
+            if (mAction == ACTION_UPDATE_TOKEN || !mHostUrlInputEnabled) {\r
                 checkOcServer(); \r
             }\r
 \r
@@ -452,6 +468,11 @@ implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
 \r
     private void checkOcServer() {\r
         String uri = trimUrlWebdav(mHostUrlInput.getText().toString().trim());\r
+        \r
+        if (!mHostUrlInputEnabled){\r
+            uri = getString(R.string.server_url);\r
+        }\r
+        \r
         mServerIsValid = false;\r
         mServerIsChecked = false;\r
         mOkButton.setEnabled(false);\r
@@ -1195,14 +1216,10 @@ implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
 \r
 \r
     private void showRefreshButton() {\r
-        /*mHostUrlInput.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_action_refresh_black, 0);\r
-        mRefreshButtonEnabled = true;*/\r
         mRefreshButton.setVisibility(View.VISIBLE);\r
     }\r
 \r
     private void hideRefreshButton() {\r
-        /*mHostUrlInput.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);\r
-        mRefreshButtonEnabled = false;*/\r
         mRefreshButton.setVisibility(View.GONE);\r
     }\r
 \r