Merge branch 'develop' into login_view_layout_improvements
authorDavid A. Velasco <dvelasco@solidgear.es>
Wed, 22 May 2013 10:54:30 +0000 (12:54 +0200)
committerDavid A. Velasco <dvelasco@solidgear.es>
Wed, 22 May 2013 10:54:30 +0000 (12:54 +0200)
res/drawable-hdpi/logo.png [new file with mode: 0644]
res/drawable-hdpi/owncloud_logo.png [deleted file]
res/drawable-ldpi/logo.png [new file with mode: 0644]
res/drawable-ldpi/owncloud_logo.png [deleted file]
res/drawable-mdpi/logo.png [new file with mode: 0644]
res/drawable-mdpi/owncloud_logo.png [deleted file]
res/layout-land/account_setup.xml
res/layout/account_setup.xml
res/layout/file_preview.xml
res/values/strings.xml
src/com/owncloud/android/authentication/AuthenticatorActivity.java

diff --git a/res/drawable-hdpi/logo.png b/res/drawable-hdpi/logo.png
new file mode 100644 (file)
index 0000000..ecea3b0
Binary files /dev/null and b/res/drawable-hdpi/logo.png differ
diff --git a/res/drawable-hdpi/owncloud_logo.png b/res/drawable-hdpi/owncloud_logo.png
deleted file mode 100644 (file)
index ecea3b0..0000000
Binary files a/res/drawable-hdpi/owncloud_logo.png and /dev/null differ
diff --git a/res/drawable-ldpi/logo.png b/res/drawable-ldpi/logo.png
new file mode 100644 (file)
index 0000000..62dff25
Binary files /dev/null and b/res/drawable-ldpi/logo.png differ
diff --git a/res/drawable-ldpi/owncloud_logo.png b/res/drawable-ldpi/owncloud_logo.png
deleted file mode 100644 (file)
index 62dff25..0000000
Binary files a/res/drawable-ldpi/owncloud_logo.png and /dev/null differ
diff --git a/res/drawable-mdpi/logo.png b/res/drawable-mdpi/logo.png
new file mode 100644 (file)
index 0000000..ecea3b0
Binary files /dev/null and b/res/drawable-mdpi/logo.png differ
diff --git a/res/drawable-mdpi/owncloud_logo.png b/res/drawable-mdpi/owncloud_logo.png
deleted file mode 100644 (file)
index ecea3b0..0000000
Binary files a/res/drawable-mdpi/owncloud_logo.png and /dev/null differ
index ce78ace..b8b8b53 100644 (file)
   You should have received a copy of the GNU General Public License\r
   along with this program.  If not, see <http://www.gnu.org/licenses/>.\r
 -->\r
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"\r
-    xmlns:oc="http://schemas.android.com/apk/res/com.owncloud.android"\r
-    android:layout_width="fill_parent"\r
-    android:layout_height="fill_parent"\r
-    android:focusable="true"\r
-    android:gravity="center|fill"\r
-    android:orientation="vertical" >\r
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"\r
+    android:layout_width="match_parent"\r
+    android:layout_height="match_parent"\r
+       android:padding="8dip"\r
+    >\r
 \r
-    <FrameLayout\r
+    <LinearLayout\r
         android:layout_width="match_parent"\r
         android:layout_height="wrap_content"\r
-        android:layout_gravity="center"\r
-        android:layout_marginLeft="16dip"\r
-        android:layout_marginRight="16dip"\r
-        android:layout_weight="1" >\r
-\r
-        <LinearLayout\r
-            android:layout_width="match_parent"\r
-            android:layout_height="match_parent" >\r
-\r
-            <ImageView\r
-                android:id="@+id/imageView1"\r
-                android:layout_width="match_parent"\r
-                android:layout_height="match_parent"\r
-                android:layout_margin="7dp"\r
-                android:layout_weight="1"\r
-                android:src="@drawable/owncloud_logo" />\r
-\r
-            <LinearLayout\r
-                android:id="@+id/LinearLayout1"\r
-                android:layout_width="match_parent"\r
-                android:layout_height="wrap_content"\r
-                android:layout_gravity="center"\r
-                android:layout_weight="1"\r
-                android:orientation="vertical" >\r
-\r
-                <FrameLayout\r
-                    android:layout_width="match_parent"\r
-                    android:layout_height="wrap_content"\r
-                    android:layout_weight="1" >\r
-\r
-                    <EditText\r
-                        android:id="@+id/hostUrlInput"\r
-                        android:layout_width="match_parent"\r
-                        android:layout_height="wrap_content"\r
-                        android:ems="10"\r
-                        android:hint="@string/auth_host_url"\r
-                        android:inputType="textNoSuggestions">\r
-                        <requestFocus />\r
-                    </EditText>\r
-\r
-                    <ImageView\r
-                        android:id="@+id/refreshButton"\r
-                        android:layout_width="wrap_content"\r
-                        android:layout_height="wrap_content"\r
-                        android:layout_gravity="right|center_vertical"\r
-                        android:src="@drawable/ic_action_refresh_black"\r
-                       android:onClick="onRefreshClick"\r
-                        android:visibility="invisible" />\r
-                </FrameLayout>\r
-\r
-                <LinearLayout\r
-                    android:layout_width="match_parent"\r
-                    android:layout_height="50dp"\r
-                    android:layout_weight="1" >\r
-\r
-                    <ImageView\r
-                        android:id="@+id/action_indicator"\r
-                        android:layout_width="wrap_content"\r
-                        android:layout_height="wrap_content"\r
-                        android:layout_marginLeft="5dp"\r
-                        android:layout_marginRight="5dp"\r
-                        android:src="@android:drawable/stat_notify_sync"\r
-                        android:visibility="invisible" />\r
-\r
-                    <TextView\r
-                        android:id="@+id/status_text"\r
-                        android:layout_width="wrap_content"\r
-                        android:layout_height="wrap_content"\r
-                        android:text="TextView"\r
-                        android:visibility="invisible" />\r
-                </LinearLayout>\r
-\r
-                <CheckBox\r
-                    android:id="@+id/oauth_onOff_check"\r
-                    android:layout_width="wrap_content"\r
-                    android:layout_height="wrap_content"\r
-                    android:checked="false"\r
-                    android:onClick="onCheckClick"\r
-                    android:text="@string/oauth_check_onoff"\r
-                    android:textAppearance="?android:attr/textAppearanceSmall" />\r
-\r
-                <TextView\r
-                    android:id="@+id/textView2"\r
-                    android:layout_width="wrap_content"\r
-                    android:layout_height="0dp"\r
-                    android:layout_weight="1"\r
-                    android:text="@string/auth_login_details"\r
-                    android:textAppearance="?android:attr/textAppearanceSmall" />\r
-\r
-                   <EditText\r
-                       android:id="@+id/oAuthEntryPoint_1"\r
-                       android:layout_width="match_parent"\r
-                       android:layout_height="wrap_content"\r
-                       android:layout_weight="1"\r
-                       android:ems="10"\r
-                       android:enabled="false"\r
-                       android:text="@string/oauth2_url_endpoint_auth"\r
-                       android:singleLine="true"\r
-                       android:visibility="gone" >\r
-       \r
-                       <requestFocus />\r
-                   </EditText>            \r
-       \r
-                   <EditText\r
-                       android:id="@+id/oAuthEntryPoint_2"\r
-                       android:layout_width="match_parent"\r
-                       android:layout_height="wrap_content"\r
-                       android:layout_weight="1"\r
-                       android:ems="10"\r
-                       android:enabled="false"\r
-                       android:text="@string/oauth2_url_endpoint_access"\r
-                       android:singleLine="true"\r
-                       android:visibility="gone" >\r
-       \r
-                       <requestFocus />\r
-                   </EditText>            \r
-       \r
-                <EditText\r
-                    android:id="@+id/account_username"\r
-                    android:layout_width="match_parent"\r
-                    android:layout_height="0dp"\r
-                    android:layout_weight="1"\r
-                    android:ems="10"\r
-                    android:hint="@string/auth_username"\r
-                    android:inputType="textNoSuggestions" />\r
-\r
-                <FrameLayout\r
-                    android:layout_width="match_parent"\r
-                    android:layout_height="wrap_content"\r
-                    android:layout_weight="1" >\r
-\r
-                    <EditText\r
-                        android:id="@+id/account_password"\r
-                        android:layout_width="match_parent"\r
-                        android:layout_height="wrap_content"\r
-                        android:ems="10"\r
-                        android:hint="@string/auth_password"\r
-                        android:inputType="textPassword"/>\r
-\r
-                    <ImageView\r
-                        android:id="@+id/viewPasswordButton"\r
-                        android:layout_width="wrap_content"\r
-                        android:layout_height="wrap_content"\r
-                        android:layout_gravity="right|center_vertical"\r
-                        android:src="@android:drawable/ic_menu_view"\r
-                                               android:onClick="onViewPasswordClick"\r
-                        android:visibility="invisible" />\r
-                </FrameLayout>\r
-                \r
-                   <TextView\r
-                       android:id="@+id/auth_status_text"\r
-                       android:layout_width="match_parent"\r
-                       android:layout_height="wrap_content"\r
-                       android:layout_weight="1" \r
-                       android:text="@string/text_placeholder"\r
-                       android:layout_marginLeft="5dp"\r
-                       android:layout_marginRight="5dp"\r
-                                       android:drawableLeft="@android:drawable/stat_notify_sync"\r
-                               android:drawablePadding="5dip"\r
-                               android:visibility="invisible"                \r
-                       />\r
-                \r
-            </LinearLayout>\r
-            \r
-        </LinearLayout>\r
-    </FrameLayout>\r
-\r
-    <RelativeLayout\r
-        android:layout_width="match_parent"\r
-        android:layout_height="wrap_content"\r
-        android:layout_alignParentBottom="true" >\r
-\r
-        <LinearLayout\r
-            android:id="@+id/buttons_layout"        \r
-            android:layout_width="match_parent"\r
-            android:layout_height="wrap_content"\r
-            android:weightSum="1">\r
-\r
-            <Button\r
-                android:id="@+id/buttonOK"\r
-                android:layout_width="match_parent"\r
-                android:layout_height="wrap_content"\r
-                android:layout_weight=".5"\r
-                android:layout_marginLeft="16dip"\r
-                       android:layout_marginRight="16dip"\r
-                android:enabled="false"\r
-                android:onClick="onOkClick"\r
-                android:text="@string/setup_btn_connect"\r
-                android:textColor="@android:color/black" />\r
-            \r
-        </LinearLayout>\r
+        android:layout_above="@id/buttonOK"\r
+        android:layout_alignParentTop="true"\r
+        android:orientation="horizontal" >\r
         \r
-               <Button\r
-                       android:id="@+id/account_register"\r
-                       android:layout_width="wrap_content"\r
+               <ImageView\r
+                       android:id="@+id/imageView1"\r
+                       android:layout_width="0dp"\r
                        android:layout_height="wrap_content"\r
-                       android:layout_below="@id/buttons_layout"\r
-                       android:layout_centerHorizontal="true"\r
-                       android:onClick="onRegisterClick"\r
-                       android:paddingTop="10dp"\r
-                       android:paddingBottom="10dp"\r
-                       android:textColor="#0000FF"\r
-                       android:background="@android:color/transparent" />\r
-                       <!-- android:text="@string/app_name @string/auth_register" /-->\r
-        \r
-    </RelativeLayout>\r
-\r
-</LinearLayout>\r
+                       android:layout_weight="1"\r
+                       android:layout_gravity="center"\r
+                       android:src="@drawable/logo" \r
+                       />\r
+               \r
+               <ScrollView\r
+                   android:layout_width="0dp"\r
+                   android:layout_height="match_parent"\r
+                   android:layout_weight="1"\r
+                   android:fillViewport="true"\r
+                   android:orientation="vertical" >\r
+                                               \r
+                       <LinearLayout\r
+                           android:id="@+id/LinearLayout1"\r
+                           android:layout_width="match_parent"\r
+                           android:layout_height="wrap_content"\r
+                           android:focusable="true"\r
+                           android:gravity="center"\r
+                           android:orientation="vertical"\r
+                           android:padding="8dp" >\r
+               \r
+                               <EditText\r
+                                       android:id="@+id/hostUrlInput"\r
+                                       android:layout_width="match_parent"\r
+                                       android:layout_height="wrap_content"\r
+                                       android:ems="10"\r
+                                       android:hint="@string/auth_host_url"\r
+                                       android:inputType="textUri"\r
+                                       android:drawablePadding="5dp"\r
+                                       >\r
+                                       <requestFocus />\r
+                               </EditText>\r
+               \r
+                               <TextView\r
+                                       android:id="@+id/server_status_text"\r
+                                       android:layout_width="match_parent"\r
+                                       android:layout_height="wrap_content"\r
+                                       android:layout_marginBottom="10dp"\r
+                                       android:drawableLeft="@android:drawable/stat_notify_sync"\r
+                                       android:drawablePadding="5dp"\r
+                                       android:gravity="center_vertical"\r
+                                       android:text="@string/auth_testing_connection" />\r
+                            \r
+                               <CheckBox\r
+                                       android:id="@+id/oauth_onOff_check"\r
+                                       android:layout_width="wrap_content"\r
+                                       android:layout_height="wrap_content"\r
+                                       android:checked="false"\r
+                                       android:onClick="onCheckClick"\r
+                                       android:text="@string/oauth_check_onoff"\r
+                                       android:textAppearance="?android:attr/textAppearanceSmall"\r
+                                       android:visibility="gone"\r
+                                       />\r
+               \r
+                               <EditText\r
+                                       android:id="@+id/oAuthEntryPoint_1"\r
+                                       android:layout_width="match_parent"\r
+                                       android:layout_height="wrap_content"\r
+                                       android:ems="10"\r
+                                       android:enabled="false"\r
+                                       android:text="@string/oauth2_url_endpoint_auth"\r
+                                       android:singleLine="true"\r
+                                       android:inputType="textUri"\r
+                                       android:visibility="gone" >\r
+                                       <requestFocus />\r
+                               </EditText>            \r
+                               \r
+                               <EditText\r
+                                       android:id="@+id/oAuthEntryPoint_2"\r
+                                       android:layout_width="match_parent"\r
+                                       android:layout_height="wrap_content"\r
+                                       android:ems="10"\r
+                                       android:enabled="false"\r
+                                       android:text="@string/oauth2_url_endpoint_access"\r
+                                       android:singleLine="true"\r
+                                       android:inputType="textUri"\r
+                                       android:visibility="gone" >\r
+                                       <requestFocus />\r
+                               </EditText>            \r
+               \r
+                               <EditText\r
+                                       android:id="@+id/account_username"\r
+                                       android:layout_width="match_parent"\r
+                                       android:layout_height="wrap_content"\r
+                                       android:ems="10"\r
+                                       android:hint="@string/auth_username"\r
+                                       android:inputType="textNoSuggestions" />\r
+               \r
+                               <FrameLayout\r
+                                       android:layout_width="match_parent"\r
+                                       android:layout_height="wrap_content"\r
+                                       >\r
+                                       <EditText\r
+                                               android:id="@+id/account_password"\r
+                                               android:layout_width="match_parent"\r
+                                               android:layout_height="wrap_content"\r
+                                               android:ems="10"\r
+                                               android:hint="@string/auth_password"\r
+                                               android:inputType="textPassword"/>\r
+                                       \r
+                                       <ImageView\r
+                                               android:id="@+id/viewPasswordButton"\r
+                                               android:layout_width="wrap_content"\r
+                                               android:layout_height="wrap_content"\r
+                                               android:layout_gravity="right|center_vertical"\r
+                                               android:src="@android:drawable/ic_menu_view"\r
+                                               android:onClick="onViewPasswordClick"\r
+                                               android:visibility="invisible" />\r
+                               </FrameLayout>\r
+                    \r
+                               <TextView\r
+                                       android:id="@+id/auth_status_text"\r
+                                       android:layout_width="match_parent"\r
+                                       android:layout_height="wrap_content"\r
+                                       android:gravity="center_vertical"\r
+                                       android:text="@string/auth_unauthorized"\r
+                                       android:drawableLeft="@android:drawable/stat_notify_sync"\r
+                                       android:drawablePadding="5dip"\r
+                                       />\r
+\r
+                       </LinearLayout>\r
+               \r
+               </ScrollView>\r
+                                                          \r
+       </LinearLayout>\r
+       \r
+       <Button\r
+               android:id="@id/buttonOK"\r
+               android:layout_width="match_parent"\r
+               android:layout_height="wrap_content"\r
+               android:layout_above="@id/account_register"\r
+               android:layout_centerHorizontal="true"\r
+               android:enabled="false"\r
+               android:onClick="onOkClick"\r
+               android:text="@string/setup_btn_connect"\r
+               />\r
+\r
+       <Button\r
+               android:id="@+id/account_register"\r
+               android:layout_width="wrap_content"\r
+               android:layout_height="wrap_content"\r
+               android:layout_centerHorizontal="true"\r
+               android:layout_alignParentBottom="true"\r
+               android:background="@android:color/transparent"\r
+               android:textColor="#0000FF"\r
+               android:onClick="onRegisterClick"\r
+               android:paddingTop="5dp"\r
+               android:paddingBottom="5dp"\r
+               android:text="@string/auth_register" \r
+               />\r
+       \r
+</RelativeLayout>\r
index d541c09..45efab1 100644 (file)
   You should have received a copy of the GNU General Public License\r
   along with this program.  If not, see <http://www.gnu.org/licenses/>.\r
 -->\r
-\r
-\r
 <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"\r
     android:layout_width="match_parent"\r
     android:layout_height="match_parent"\r
+    android:layout_gravity="center"\r
+    android:fillViewport="true"\r
     android:orientation="vertical" >\r
 \r
-       <LinearLayout\r
-           android:layout_width="match_parent"\r
-           android:layout_height="wrap_content"\r
-           android:layout_gravity="center"\r
-           android:focusable="true"\r
-           android:gravity="center"\r
-           android:orientation="vertical" >\r
+    <LinearLayout\r
+        android:layout_width="match_parent"\r
+        android:layout_height="wrap_content"\r
+        android:focusable="true"\r
+        android:gravity="center"\r
+        android:orientation="vertical"\r
+        android:padding="8dp" >\r
 \r
-       <FrameLayout\r
+        <ImageView\r
+            android:id="@+id/imageView1"\r
+            android:layout_width="match_parent"\r
+            android:layout_height="wrap_content"\r
+            android:layout_marginBottom="10dp"\r
+            android:layout_marginTop="10dp"\r
+            android:src="@drawable/logo" />\r
+\r
+               <EditText\r
+                       android:id="@+id/hostUrlInput"\r
                        android:layout_width="match_parent"\r
-                       android:layout_height="0dip"\r
-                       android:layout_gravity="center"\r
-                       android:layout_marginBottom="50dip"\r
-                       android:layout_marginLeft="16dip"\r
-                       android:layout_marginRight="16dip"\r
-                       android:layout_weight="1" >\r
-               \r
-                       <LinearLayout\r
-                               android:id="@+id/LinearLayout1"\r
-                               android:layout_width="match_parent"\r
-                               android:layout_height="wrap_content"\r
-                               android:layout_gravity="center"\r
-                               android:orientation="vertical" >\r
-               \r
-                               <ImageView\r
-                                       android:id="@+id/imageView1"\r
-                                       android:layout_width="match_parent"\r
-                                       android:layout_height="wrap_content"\r
-                                       android:layout_marginBottom="10dp"\r
-                                       android:layout_weight="1"\r
-                                       android:src="@drawable/owncloud_logo" />\r
-               \r
-                   <FrameLayout\r
-                       android:layout_width="match_parent"\r
-                       android:layout_height="wrap_content"\r
-                       android:layout_weight="1" >\r
-       \r
-                       <EditText\r
-                           android:id="@+id/hostUrlInput"\r
-                           android:layout_width="match_parent"\r
-                           android:layout_height="wrap_content"\r
-                           android:ems="10"\r
-                           android:hint="@string/auth_host_url"\r
-                           android:inputType="textNoSuggestions" >\r
-                           <requestFocus />\r
-                       </EditText>\r
-       \r
-                       <ImageView\r
-                           android:id="@+id/refreshButton"\r
-                           android:layout_width="wrap_content"\r
-                           android:layout_height="wrap_content"\r
-                           android:src="@drawable/ic_action_refresh_black"\r
-                           android:layout_gravity="right|center_vertical"\r
-                           android:visibility="invisible" />\r
-       \r
-                   </FrameLayout>\r
-       \r
-                   <LinearLayout\r
-                       android:layout_width="match_parent"\r
-                       android:layout_height="50dp"\r
-                       android:layout_weight="1" >\r
-       \r
-                       <ImageView\r
-                           android:id="@+id/action_indicator"\r
-                           android:layout_width="wrap_content"\r
-                           android:layout_height="wrap_content"\r
-                           android:layout_marginLeft="5dp"\r
-                           android:layout_marginRight="5dp"\r
-                           android:src="@android:drawable/stat_notify_sync"\r
-                           android:visibility="invisible" />\r
-       \r
-                       <TextView\r
-                           android:id="@+id/status_text"\r
-                           android:layout_width="wrap_content"\r
-                           android:layout_height="wrap_content"\r
-                           android:text="TextView"\r
-                           android:visibility="invisible" />\r
-       \r
-                   </LinearLayout>\r
-       \r
-                   <CheckBox\r
-                       android:id="@+id/oauth_onOff_check"\r
-                       android:layout_width="wrap_content"\r
-                       android:layout_height="wrap_content"\r
-                       android:checked="false"\r
-                       android:onClick="onCheckClick"\r
-                       android:text="@string/oauth_check_onoff"\r
-                       android:textAppearance="?android:attr/textAppearanceSmall" />\r
-       \r
-                               <TextView\r
-                       android:id="@+id/textView2"\r
-                       android:layout_width="wrap_content"\r
-                       android:layout_height="0dp"\r
-                       android:layout_weight="1"\r
-                       android:text="@string/auth_login_details"\r
-                       android:textAppearance="?android:attr/textAppearanceSmall" />\r
-       \r
-                   <EditText\r
-                       android:id="@+id/oAuthEntryPoint_1"\r
-                       android:layout_width="match_parent"\r
-                       android:layout_height="wrap_content"\r
-                       android:layout_weight="1"\r
-                       android:ems="10"\r
-                       android:text="@string/oauth2_url_endpoint_auth"\r
-                       android:singleLine="true"\r
-                       android:visibility="gone" >\r
-       \r
-                       <requestFocus />\r
-                   </EditText>            \r
-       \r
-                   <EditText\r
-                       android:id="@+id/oAuthEntryPoint_2"\r
-                       android:layout_width="match_parent"\r
-                       android:layout_height="wrap_content"\r
-                       android:layout_weight="1"\r
-                       android:ems="10"\r
-                           android:text="@string/oauth2_url_endpoint_access"\r
-                       android:singleLine="true"\r
-                       android:visibility="gone" >\r
-       \r
-                       <requestFocus />\r
-                   </EditText>            \r
-       \r
-                               <EditText\r
-                       android:id="@+id/account_username"\r
-                       android:layout_width="match_parent"\r
-                       android:layout_height="0dp"\r
-                       android:layout_weight="1"\r
-                       android:ems="10"\r
-                       android:hint="@string/auth_username"\r
-                       android:inputType="textNoSuggestions" />\r
-       \r
-                   <FrameLayout\r
-                       android:layout_width="match_parent"\r
-                       android:layout_height="wrap_content"\r
-                       android:layout_weight="1" >\r
-       \r
-                       <EditText\r
-                           android:id="@+id/account_password"\r
-                           android:layout_width="match_parent"\r
-                           android:layout_height="wrap_content"\r
-                           android:ems="10"\r
-                           android:hint="@string/auth_password"\r
-                           android:inputType="textPassword"/>\r
-       \r
-                       <ImageView\r
-                           android:id="@+id/viewPasswordButton"\r
-                           android:layout_width="wrap_content"\r
-                           android:layout_height="wrap_content"\r
-                           android:layout_gravity="right|center_vertical"\r
-                           android:src="@android:drawable/ic_menu_view"\r
-                                               android:onClick="onViewPasswordClick"\r
-                           android:visibility="invisible" />\r
-       \r
-                   </FrameLayout>\r
-               \r
-                   <TextView\r
-                       android:id="@+id/auth_status_text"\r
-                       android:layout_width="match_parent"\r
-                       android:layout_height="wrap_content"\r
-                       android:layout_weight="1" \r
-                       android:text="@string/text_placeholder"\r
-                       android:layout_marginLeft="5dp"\r
-                       android:layout_marginRight="5dp"\r
-                                       android:drawableLeft="@android:drawable/stat_notify_sync"\r
-                               android:drawablePadding="5dip"\r
-                               android:visibility="invisible"                \r
-                       />\r
-                           \r
-                  </LinearLayout>\r
-       \r
-           </FrameLayout>\r
-       \r
-           <RelativeLayout\r
-               android:layout_width="match_parent"\r
-               android:layout_height="wrap_content">\r
-       \r
-               <LinearLayout\r
-                   android:id="@+id/buttons_layout"\r
-                   android:layout_width="match_parent"\r
-                   android:layout_height="wrap_content"\r
-                   android:weightSum="1">\r
-       \r
-                   <Button\r
-                       android:id="@+id/buttonOK"\r
-                       android:layout_width="match_parent"\r
-                       android:layout_height="wrap_content"\r
-                           android:layout_gravity="center_horizontal"\r
-                               android:layout_marginLeft="16dip"\r
-                           android:layout_marginRight="16dip"\r
-                       android:enabled="false"\r
-                       android:onClick="onOkClick"\r
-                       android:text="@string/setup_btn_connect"\r
-                       android:textColor="@android:color/black" />\r
-       \r
-               </LinearLayout>\r
-               \r
-                       <Button\r
-                               android:id="@+id/account_register"\r
-                               android:layout_width="wrap_content"\r
-                               android:layout_height="wrap_content"\r
-                               android:layout_below="@id/buttons_layout"\r
-                               android:layout_centerHorizontal="true"\r
-                               android:onClick="onRegisterClick"\r
-                               android:paddingTop="10dp"\r
-                               android:paddingBottom="10dp"\r
-                               android:textColor="#0000FF"\r
-                               android:background="@android:color/transparent" />\r
-                       \r
-                       <Button\r
-                               android:id="@+id/account_register"\r
-                               android:layout_width="wrap_content"\r
-                               android:layout_height="wrap_content"\r
-                               android:layout_below="@id/buttons_layout"\r
-                               android:layout_centerHorizontal="true"\r
-                               android:onClick="onRegisterClick"\r
-                               android:paddingTop="10dp"\r
-                               android:paddingBottom="10dp"\r
-                               android:textColor="#0000FF"\r
-                               android:background="@android:color/transparent" />\r
-                               <!-- android:text="@string/app_name @string/auth_register" /-->\r
-               \r
-           </RelativeLayout>\r
-\r
-       </LinearLayout>\r
-                       \r
-</ScrollView>\r
+                       android:layout_height="wrap_content"\r
+                       android:ems="10"\r
+                       android:hint="@string/auth_host_url"\r
+                       android:inputType="textUri"\r
+                       android:drawablePadding="5dp"\r
+                       >\r
+                       <requestFocus />\r
+               </EditText>\r
+\r
+        <TextView\r
+            android:id="@+id/server_status_text"\r
+            android:layout_width="match_parent"\r
+            android:layout_height="wrap_content"\r
+            android:layout_marginBottom="10dp"\r
+            android:drawableLeft="@android:drawable/stat_notify_sync"\r
+            android:drawablePadding="5dp"\r
+            android:gravity="center_vertical"\r
+            android:text="@string/auth_testing_connection" />\r
+\r
+        <CheckBox\r
+            android:id="@+id/oauth_onOff_check"\r
+            android:layout_width="wrap_content"\r
+            android:layout_height="wrap_content"\r
+            android:checked="false"\r
+            android:onClick="onCheckClick"\r
+            android:text="@string/oauth_check_onoff"\r
+            android:textAppearance="?android:attr/textAppearanceSmall"\r
+            android:visibility="gone" />\r
+\r
+        <EditText\r
+            android:id="@+id/oAuthEntryPoint_1"\r
+            android:layout_width="match_parent"\r
+            android:layout_height="wrap_content"\r
+            android:ems="10"\r
+            android:inputType="textUri"\r
+            android:singleLine="true"\r
+            android:text="@string/oauth2_url_endpoint_auth"\r
+            android:visibility="gone" >\r
+        </EditText>\r
+\r
+        <EditText\r
+            android:id="@+id/oAuthEntryPoint_2"\r
+            android:layout_width="match_parent"\r
+            android:layout_height="wrap_content"\r
+            android:ems="10"\r
+            android:inputType="textUri"\r
+            android:singleLine="true"\r
+            android:text="@string/oauth2_url_endpoint_access"\r
+            android:visibility="gone" />\r
+\r
+        <EditText\r
+            android:id="@+id/account_username"\r
+            android:layout_width="match_parent"\r
+            android:layout_height="wrap_content"\r
+            android:ems="10"\r
+            android:hint="@string/auth_username"\r
+            android:inputType="textNoSuggestions" />\r
+\r
+        <FrameLayout\r
+            android:layout_width="match_parent"\r
+            android:layout_height="wrap_content" >\r
+\r
+            <EditText\r
+                android:id="@+id/account_password"\r
+                android:layout_width="match_parent"\r
+                android:layout_height="wrap_content"\r
+                android:ems="10"\r
+                android:hint="@string/auth_password"\r
+                android:inputType="textPassword" />\r
+\r
+            <ImageView\r
+                android:id="@+id/viewPasswordButton"\r
+                android:layout_width="wrap_content"\r
+                android:layout_height="wrap_content"\r
+                android:layout_gravity="right|center_vertical"\r
+                android:onClick="onViewPasswordClick"\r
+                android:src="@android:drawable/ic_menu_view"\r
+                android:visibility="invisible" />\r
+        </FrameLayout>\r
+\r
+        <TextView\r
+            android:id="@+id/auth_status_text"\r
+            android:layout_width="match_parent"\r
+            android:layout_height="wrap_content"\r
+            android:layout_marginBottom="10dp"\r
+            android:drawableLeft="@android:drawable/stat_notify_sync"\r
+            android:drawablePadding="5dp"\r
+            android:gravity="center_vertical"\r
+            android:text="@string/auth_unauthorized" />\r
+\r
+        <Button\r
+            android:id="@+id/buttonOK"\r
+            android:layout_width="match_parent"\r
+            android:layout_height="wrap_content"\r
+            android:layout_gravity="center_horizontal"\r
+            android:enabled="false"\r
+            android:onClick="onOkClick"\r
+            android:text="@string/setup_btn_connect"\r
+            />\r
+\r
+        <Button\r
+            android:id="@+id/account_register"\r
+            android:layout_width="wrap_content"\r
+            android:layout_height="wrap_content"\r
+            android:background="@android:color/transparent"\r
+            android:textColor="#0000FF" \r
+            android:onClick="onRegisterClick"\r
+            android:paddingBottom="5dp"\r
+            android:paddingTop="5dp"\r
+            android:text="@string/auth_register"\r
+            />\r
+    </LinearLayout>\r
+\r
+</ScrollView>
\ No newline at end of file
index 22528a7..ec69fe7 100644 (file)
@@ -42,7 +42,7 @@
                android:layout_margin="16dp"
                android:layout_gravity="center"
                android:contentDescription="@string/preview_image_description"
-               android:src="@drawable/owncloud_logo" />
+               android:src="@drawable/logo" />
            
                <VideoView  
                    android:id="@+id/video_preview"
index 7520dc6..2d6de4b 100644 (file)
     <string name="auth_bad_oc_version_title">Unrecognized server version</string>
     <string name="auth_wrong_connection_title">Couldn\'t establish connection</string>
     <string name="auth_secure_connection">Secure connection established</string>
-    <string name="auth_login_details">Login details</string>
     <string name="auth_unauthorized">Invalid credentials</string>
        <string name="auth_oauth_error">Unsuccessful authorization</string>
        <string name="auth_oauth_error_access_denied">Access denied by authorization server</string>
index ef5c21b..375ef3b 100644 (file)
@@ -42,20 +42,29 @@ import android.content.ContentResolver;
 import android.content.DialogInterface;\r
 import android.content.Intent;\r
 import android.content.SharedPreferences;\r
+import android.graphics.Rect;\r
+import android.graphics.drawable.Drawable;\r
 import android.net.Uri;\r
 import android.os.Bundle;\r
 import android.os.Handler;\r
 import android.preference.PreferenceManager;\r
+import android.text.Editable;\r
 import android.text.InputType;\r
+import android.text.TextWatcher;\r
+import android.view.KeyEvent;\r
+import android.view.MotionEvent;\r
 import android.view.View;\r
 import android.view.View.OnFocusChangeListener;\r
+import android.view.View.OnTouchListener;\r
 import android.view.Window;\r
+import android.view.inputmethod.EditorInfo;\r
 import android.widget.CheckBox;\r
 import android.widget.EditText;\r
 import android.widget.Button;\r
 import android.widget.ImageView;\r
 import android.widget.TextView;\r
 import android.widget.Toast;\r
+import android.widget.TextView.OnEditorActionListener;\r
 \r
 import com.owncloud.android.R;\r
 \r
@@ -68,7 +77,7 @@ import eu.alefzero.webdav.WebdavClient;
  * @author David A. Velasco\r
  */\r
 public class AuthenticatorActivity extends AccountAuthenticatorActivity\r
-        implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeListener {\r
+        implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeListener, OnEditorActionListener {\r
 \r
     private static final String TAG = AuthenticatorActivity.class.getSimpleName();\r
 \r
@@ -80,12 +89,14 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
     private static final String KEY_HOST_URL_TEXT = "HOST_URL_TEXT";\r
     private static final String KEY_OC_VERSION = "OC_VERSION";\r
     private static final String KEY_ACCOUNT = "ACCOUNT";\r
-    private static final String KEY_STATUS_TEXT = "STATUS_TEXT";\r
-    private static final String KEY_STATUS_ICON = "STATUS_ICON";\r
-    private static final String KEY_STATUS_CORRECT = "STATUS_CORRECT";\r
+    private static final String KEY_SERVER_VALID = "SERVER_VALID";\r
+    private static final String KEY_SERVER_CHECKED = "SERVER_CHECKED";\r
+    private static final String KEY_SERVER_CHECK_IN_PROGRESS = "SERVER_CHECK_IN_PROGRESS"; \r
+    private static final String KEY_SERVER_STATUS_TEXT = "SERVER_STATUS_TEXT";\r
+    private static final String KEY_SERVER_STATUS_ICON = "SERVER_STATUS_ICON";\r
     private static final String KEY_IS_SSL_CONN = "IS_SSL_CONN";\r
-    private static final String KEY_OAUTH2_STATUS_TEXT = "OAUTH2_STATUS_TEXT";\r
-    private static final String KEY_OAUTH2_STATUS_ICON = "OAUTH2_STATUS_ICON";\r
+    private static final String KEY_AUTH_STATUS_TEXT = "AUTH_STATUS_TEXT";\r
+    private static final String KEY_AUTH_STATUS_ICON = "AUTH_STATUS_ICON";\r
     \r
     private static final String OAUTH_MODE_ON = "on";\r
     private static final String OAUTH_MODE_OFF = "off";\r
@@ -103,9 +114,9 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
     private String mHostBaseUrl;\r
     private OwnCloudVersion mDiscoveredVersion;\r
     \r
-    private int mStatusText, mStatusIcon;\r
-    private boolean mStatusCorrect, mIsSslConn;\r
-    private int mOAuth2StatusText, mOAuth2StatusIcon;    \r
+    private int mServerStatusText, mServerStatusIcon;\r
+    private boolean mServerIsChecked, mServerIsValid, mIsSslConn;\r
+    private int mAuthStatusText, mAuthStatusIcon;    \r
     \r
     private final Handler mHandler = new Handler();\r
     private Thread mOperationThread;\r
@@ -120,7 +131,6 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
     private byte mAction;\r
     private Account mAccount;\r
     \r
-    private ImageView mRefreshButton;\r
     private ImageView mViewPasswordButton;\r
     private EditText mHostUrlInput;\r
     private EditText mUsernameInput;\r
@@ -132,7 +142,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
     \r
     private TextView mOAuthAuthEndpointText;\r
     private TextView mOAuthTokenEndpointText;\r
-    \r
+\r
     \r
     /**\r
      * {@inheritDoc}\r
@@ -146,7 +156,6 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
         \r
         /// set view and get references to view elements\r
         setContentView(R.layout.account_setup);\r
-        mRefreshButton = (ImageView) findViewById(R.id.refreshButton);\r
         mViewPasswordButton = (ImageView) findViewById(R.id.viewPasswordButton);\r
         mHostUrlInput = (EditText) findViewById(R.id.hostUrlInput);\r
         mUsernameInput = (EditText) findViewById(R.id.account_username);\r
@@ -163,21 +172,20 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
             b.setText(String.format(getString(R.string.auth_register), getString(R.string.app_name)));\r
         }\r
 \r
-        /// bind view elements to listeners\r
-        mHostUrlInput.setOnFocusChangeListener(this);\r
-        mPasswordInput.setOnFocusChangeListener(this);\r
-        \r
         /// initialization\r
         mAccountMgr = AccountManager.get(this);\r
         mNewCapturedUriFromOAuth2Redirection = null;\r
         mAction = getIntent().getByteExtra(EXTRA_ACTION, ACTION_CREATE); \r
         mAccount = null;\r
+        mHostBaseUrl = "";\r
 \r
         if (savedInstanceState == null) {\r
             /// connection state and info\r
-            mStatusText = mStatusIcon = 0;\r
-            mStatusCorrect = false;\r
+            mServerStatusText = mServerStatusIcon = 0;\r
+            mServerIsValid = false;\r
+            mServerIsChecked = false;\r
             mIsSslConn = false;\r
+            mAuthStatusText = mAuthStatusIcon = 0;\r
             \r
             /// retrieve extras from intent\r
             String tokenType = getIntent().getExtras().getString(AccountAuthenticator.KEY_AUTH_TOKEN_TYPE);\r
@@ -189,7 +197,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
                 if (ocVersion != null) {\r
                     mDiscoveredVersion = new OwnCloudVersion(ocVersion);\r
                 }\r
-                mHostBaseUrl = mAccountMgr.getUserData(mAccount, AccountAuthenticator.KEY_OC_BASE_URL);\r
+                mHostBaseUrl = normalizeUrl(mAccountMgr.getUserData(mAccount, AccountAuthenticator.KEY_OC_BASE_URL));\r
                 mHostUrlInput.setText(mHostBaseUrl);\r
                 String userName = mAccount.name.substring(0, mAccount.name.lastIndexOf('@'));\r
                 mUsernameInput.setText(userName);\r
@@ -200,9 +208,37 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
             \r
 \r
         } else {\r
-            loadSavedInstanceState(savedInstanceState);\r
+            /// connection state and info\r
+            mServerIsValid = savedInstanceState.getBoolean(KEY_SERVER_VALID);\r
+            mServerIsChecked = savedInstanceState.getBoolean(KEY_SERVER_CHECKED);\r
+            mServerStatusText = savedInstanceState.getInt(KEY_SERVER_STATUS_TEXT);\r
+            mServerStatusIcon = savedInstanceState.getInt(KEY_SERVER_STATUS_ICON);\r
+            mIsSslConn = savedInstanceState.getBoolean(KEY_IS_SSL_CONN);\r
+            mAuthStatusText = savedInstanceState.getInt(KEY_AUTH_STATUS_TEXT);\r
+            mAuthStatusIcon = savedInstanceState.getInt(KEY_AUTH_STATUS_ICON);\r
+            \r
+            /// server data\r
+            String ocVersion = savedInstanceState.getString(KEY_OC_VERSION);\r
+            if (ocVersion != null) {\r
+                mDiscoveredVersion = new OwnCloudVersion(ocVersion);\r
+            }\r
+            mHostBaseUrl = savedInstanceState.getString(KEY_HOST_URL_TEXT);\r
+            \r
+            // account data, if updating\r
+            mAccount = savedInstanceState.getParcelable(KEY_ACCOUNT);\r
+            \r
+            // check if server check was interrupted by a configuration change\r
+            if (savedInstanceState.getBoolean(KEY_SERVER_CHECK_IN_PROGRESS, false)) {\r
+                checkOcServer();\r
+            }\r
+            \r
         }\r
         \r
+        showServerStatus();\r
+        showAuthStatus();\r
+        if (mServerIsChecked && !mServerIsValid) showRefreshButton();\r
+        mOkButton.setEnabled(mServerIsValid); // state not automatically recovered in configuration changes\r
+        \r
         if (!OAUTH_MODE_OPTIONAL.equals(getString(R.string.oauth2_mode))) {\r
             mOAuth2Check.setVisibility(View.GONE);\r
         }\r
@@ -212,14 +248,44 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
             mHostUrlInput.setEnabled(false);\r
             mUsernameInput.setEnabled(false);\r
             mOAuth2Check.setVisibility(View.GONE);\r
-            checkOcServer(); \r
+            if (!mServerIsValid && mOcServerChkOperation == null) {\r
+                checkOcServer(); \r
+            }\r
         }\r
         \r
         mPasswordInput.setText("");     // clean password to avoid social hacking (disadvantage: password in removed if the device is turned aside)\r
         mJustCreated = true;\r
-    }\r
+        \r
+        /// bind view elements to listeners\r
+        mHostUrlInput.setOnFocusChangeListener(this);\r
+        mHostUrlInput.setOnTouchListener(new RightDrawableOnTouchListener() {\r
+            @Override\r
+            public boolean onDrawableTouch(final MotionEvent event) {\r
+                AuthenticatorActivity.this.onRefreshClick(mHostUrlInput);\r
+                return true;\r
+            }\r
+        });\r
+        mHostUrlInput.addTextChangedListener(new TextWatcher() {\r
 \r
+            @Override\r
+            public void afterTextChanged(Editable s) {\r
+                if (!mHostBaseUrl.equals(normalizeUrl(mHostUrlInput.getText().toString()))) {\r
+                    mOkButton.setEnabled(false);\r
+                }\r
+            }\r
 \r
+            @Override\r
+            public void beforeTextChanged(CharSequence s, int start, int count, int after) {}\r
+\r
+            @Override\r
+            public void onTextChanged(CharSequence s, int start, int before, int count) {}\r
+            \r
+        });\r
+        mPasswordInput.setOnFocusChangeListener(this);\r
+        mPasswordInput.setImeOptions(EditorInfo.IME_ACTION_DONE);\r
+        mPasswordInput.setOnEditorActionListener(this);\r
+    }\r
+    \r
     /**\r
      * Saves relevant state before {@link #onPause()}\r
      * \r
@@ -233,66 +299,30 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
         super.onSaveInstanceState(outState);\r
         \r
         /// connection state and info\r
-        outState.putInt(KEY_STATUS_TEXT, mStatusText);\r
-        outState.putInt(KEY_STATUS_ICON, mStatusIcon);\r
-        outState.putBoolean(KEY_STATUS_CORRECT, mStatusCorrect);\r
+        outState.putInt(KEY_SERVER_STATUS_TEXT, mServerStatusText);\r
+        outState.putInt(KEY_SERVER_STATUS_ICON, mServerStatusIcon);\r
+        outState.putBoolean(KEY_SERVER_VALID, mServerIsValid);\r
+        outState.putBoolean(KEY_SERVER_CHECKED, mServerIsChecked);\r
+        outState.putBoolean(KEY_SERVER_CHECK_IN_PROGRESS, (!mServerIsValid && mOcServerChkOperation != null));\r
         outState.putBoolean(KEY_IS_SSL_CONN, mIsSslConn);\r
-\r
+        outState.putInt(KEY_AUTH_STATUS_ICON, mAuthStatusIcon);\r
+        outState.putInt(KEY_AUTH_STATUS_TEXT, mAuthStatusText);\r
+        \r
         /// server data\r
-        if (mDiscoveredVersion != null) \r
+        if (mDiscoveredVersion != null) {\r
             outState.putString(KEY_OC_VERSION, mDiscoveredVersion.toString());\r
+        }\r
         outState.putString(KEY_HOST_URL_TEXT, mHostBaseUrl);\r
         \r
         /// account data, if updating\r
-        if (mAccount != null)\r
+        if (mAccount != null) {\r
             outState.putParcelable(KEY_ACCOUNT, mAccount);\r
-        \r
-        // Saving the state of oAuth2 components.\r
-        outState.putInt(KEY_OAUTH2_STATUS_ICON, mOAuth2StatusIcon);\r
-        outState.putInt(KEY_OAUTH2_STATUS_TEXT, mOAuth2StatusText);\r
+        }\r
         \r
     }\r
 \r
 \r
     /**\r
-     * Loads saved state\r
-     * \r
-     * See {@link #onSaveInstanceState(Bundle)}.\r
-     * \r
-     * @param savedInstanceState    Saved state, as received in {@link #onCreate(Bundle)}.\r
-     */\r
-    private void loadSavedInstanceState(Bundle savedInstanceState) {\r
-        /// connection state and info\r
-        mStatusCorrect = savedInstanceState.getBoolean(KEY_STATUS_CORRECT);\r
-        mIsSslConn = savedInstanceState.getBoolean(KEY_IS_SSL_CONN);\r
-        mStatusText = savedInstanceState.getInt(KEY_STATUS_TEXT);\r
-        mStatusIcon = savedInstanceState.getInt(KEY_STATUS_ICON);\r
-        updateConnStatus();\r
-        \r
-        /// UI settings depending upon connection\r
-        mOkButton.setEnabled(mStatusCorrect);   // TODO really necessary?\r
-        if (!mStatusCorrect)\r
-            mRefreshButton.setVisibility(View.VISIBLE); // seems that setting visibility is necessary\r
-        else\r
-            mRefreshButton.setVisibility(View.INVISIBLE);\r
-        \r
-        /// server data\r
-        String ocVersion = savedInstanceState.getString(KEY_OC_VERSION);\r
-        if (ocVersion != null)\r
-            mDiscoveredVersion = new OwnCloudVersion(ocVersion);\r
-        mHostBaseUrl = savedInstanceState.getString(KEY_HOST_URL_TEXT);\r
-        \r
-        // account data, if updating\r
-        mAccount = savedInstanceState.getParcelable(KEY_ACCOUNT);\r
-        \r
-        // state of oAuth2 components\r
-        mOAuth2StatusIcon = savedInstanceState.getInt(KEY_OAUTH2_STATUS_ICON);\r
-        mOAuth2StatusText = savedInstanceState.getInt(KEY_OAUTH2_STATUS_TEXT);\r
-        // END of getting the state of oAuth2 components.\r
-    }\r
-\r
-    \r
-    /**\r
      * The redirection triggered by the OAuth authentication server as response to the GET AUTHORIZATION request\r
      * is caught here.\r
      * \r
@@ -347,7 +377,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
 \r
         /// GET ACCESS TOKEN to the oAuth server \r
         RemoteOperation operation = new OAuth2GetAccessToken(   getString(R.string.oauth2_client_id), \r
-                                                                getString(R.string.oauth2_redirect_uri), // TODO check - necessary here?      \r
+                                                                getString(R.string.oauth2_redirect_uri),       \r
                                                                 getString(R.string.oauth2_grant_type),\r
                                                                 queryParameters);\r
         //WebdavClient client = OwnCloudClientUtils.createOwnCloudClient(Uri.parse(getString(R.string.oauth2_url_endpoint_access)), getApplicationContext());\r
@@ -361,8 +391,8 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
      * Handles the change of focus on the text inputs for the server URL and the password\r
      */\r
     public void onFocusChange(View view, boolean hasFocus) {\r
-        if (view.getId() == R.id.hostUrlInput) {\r
-            onUrlInputFocusChanged((TextView) view, hasFocus);\r
+        if (view.getId() == R.id.hostUrlInput && !hasFocus) {\r
+            onUrlInputFocusLost((TextView) view);\r
             \r
         } else if (view.getId() == R.id.account_password) {\r
             onPasswordFocusChanged((TextView) view, hasFocus);\r
@@ -380,39 +410,34 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
      * When hasFocus:    user 'comes back' to write again the server URL.\r
      * \r
      * @param hostInput     TextView with the URL input field receiving the change of focus.\r
-     * @param hasFocus      'True' if focus is received, 'false' if is lost\r
      */\r
-    private void onUrlInputFocusChanged(TextView hostInput, boolean hasFocus) {\r
-        if (!hasFocus) {\r
+    private void onUrlInputFocusLost(TextView hostInput) {\r
+        if (!mHostBaseUrl.equals(normalizeUrl(mHostUrlInput.getText().toString()))) {\r
             checkOcServer();\r
-            \r
         } else {\r
-            // avoids that the 'connect' button can be clicked if the test was previously passed\r
-            mOkButton.setEnabled(false); \r
+            mOkButton.setEnabled(mServerIsValid);\r
         }\r
     }\r
 \r
 \r
     private void checkOcServer() {\r
         String uri = mHostUrlInput.getText().toString().trim();\r
+        mServerIsValid = false;\r
+        mServerIsChecked = false;\r
+        mOkButton.setEnabled(false);\r
+        mDiscoveredVersion = null;\r
+        hideRefreshButton();\r
         if (uri.length() != 0) {\r
-            mStatusText = R.string.auth_testing_connection;\r
-            mStatusIcon = R.drawable.progress_small;\r
-            updateConnStatus();\r
-            /** TODO cancel previous connection check if the user tries to ammend a wrong URL  \r
-            if(mConnChkOperation != null) {\r
-                mConnChkOperation.cancel();\r
-            } */\r
+            mServerStatusText = R.string.auth_testing_connection;\r
+            mServerStatusIcon = R.drawable.progress_small;\r
+            showServerStatus();\r
             mOcServerChkOperation = new  OwnCloudServerCheckOperation(uri, this);\r
             WebdavClient client = OwnCloudClientUtils.createOwnCloudClient(Uri.parse(uri), this);\r
-            mHostBaseUrl = "";\r
-            mDiscoveredVersion = null;\r
             mOperationThread = mOcServerChkOperation.execute(client, this, mHandler);\r
         } else {\r
-            mRefreshButton.setVisibility(View.INVISIBLE);\r
-            mStatusText = 0;\r
-            mStatusIcon = 0;\r
-            updateConnStatus();\r
+            mServerStatusText = 0;\r
+            mServerStatusIcon = 0;\r
+            showServerStatus();\r
         }\r
     }\r
 \r
@@ -472,9 +497,9 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
     public void onOkClick(View view) {\r
         // this check should be unnecessary\r
         if (mDiscoveredVersion == null || !mDiscoveredVersion.isVersionValid()  || mHostBaseUrl == null || mHostBaseUrl.length() == 0) {\r
-            mStatusIcon = R.drawable.common_error;\r
-            mStatusText = R.string.auth_wtf_reenter_URL;\r
-            updateConnStatus();\r
+            mServerStatusIcon = R.drawable.common_error;\r
+            mServerStatusText = R.string.auth_wtf_reenter_URL;\r
+            showServerStatus();\r
             mOkButton.setEnabled(false);\r
             Log_OC.wtf(TAG,  "The user was allowed to click 'connect' to an unchecked server!!");\r
             return;\r
@@ -518,9 +543,9 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
      */\r
     private void startOauthorization() {\r
         // be gentle with the user\r
-        mStatusIcon = R.drawable.progress_small;\r
-        mStatusText = R.string.oauth_login_connection;\r
-        updateAuthStatus();\r
+        mAuthStatusIcon = R.drawable.progress_small;\r
+        mAuthStatusText = R.string.oauth_login_connection;\r
+        showAuthStatus();\r
         \r
         // GET AUTHORIZATION request\r
         //Uri uri = Uri.parse(getString(R.string.oauth2_url_endpoint_auth));\r
@@ -567,44 +592,133 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
      * @param result        Result of the check.\r
      */\r
     private void onOcServerCheckFinish(OwnCloudServerCheckOperation operation, RemoteOperationResult result) {\r
-        /// update status icon and text\r
-        updateStatusIconAndText(result);\r
-        updateConnStatus();\r
+        if (operation.equals(mOcServerChkOperation)) {\r
+            /// save result state\r
+            mServerIsChecked = true;\r
+            mServerIsValid = result.isSuccess();\r
+            mIsSslConn = (result.getCode() == ResultCode.OK_SSL);\r
+            mOcServerChkOperation = null;\r
+            \r
+            /// update status icon and text\r
+            if (mServerIsValid) {\r
+                hideRefreshButton();\r
+            } else {\r
+                showRefreshButton();\r
+            }\r
+            updateServerStatusIconAndText(result);\r
+            showServerStatus();\r
+    \r
+            /// very special case (TODO: move to a common place for all the remote operations)\r
+            if (result.getCode() == ResultCode.SSL_RECOVERABLE_PEER_UNVERIFIED) {\r
+                mLastSslUntrustedServerResult = result;\r
+                showDialog(DIALOG_SSL_VALIDATOR); \r
+            }\r
+            \r
+            /// retrieve discovered version and normalize server URL\r
+            mDiscoveredVersion = operation.getDiscoveredVersion();\r
+            mHostBaseUrl = normalizeUrl(mHostUrlInput.getText().toString());\r
+            \r
+            /// allow or not the user try to access the server\r
+            mOkButton.setEnabled(mServerIsValid);\r
+            \r
+        }   // else nothing ; only the last check operation is considered; \r
+            // multiple can be triggered if the user amends a URL before a previous check can be triggered\r
+    }\r
 \r
-        /// save result state\r
-        mStatusCorrect = result.isSuccess();\r
-        mIsSslConn = (result.getCode() == ResultCode.OK_SSL);\r
-        \r
-        /// very special case (TODO: move to a common place for all the remote operations)\r
-        if (result.getCode() == ResultCode.SSL_RECOVERABLE_PEER_UNVERIFIED) {\r
-            mLastSslUntrustedServerResult = result;\r
-            showDialog(DIALOG_SSL_VALIDATOR); \r
+\r
+    private String normalizeUrl(String url) {\r
+        if (url != null && url.length() > 0) {\r
+            url = url.trim();\r
+            if (!url.toLowerCase().startsWith("http://") &&\r
+                    !url.toLowerCase().startsWith("https://")) {\r
+                if (mIsSslConn) {\r
+                    url = "https://" + url;\r
+                } else {\r
+                    url = "http://" + url;\r
+                }\r
+                \r
+            }\r
+            if (url.endsWith("/")) {\r
+                url = url.substring(0, url.length() - 1);\r
+            }\r
         }\r
-        \r
-        /// update the visibility of the 'retry connection' button\r
-        if (!mStatusCorrect)\r
-            mRefreshButton.setVisibility(View.VISIBLE);\r
-        else\r
-            mRefreshButton.setVisibility(View.INVISIBLE);\r
-        \r
-        /// retrieve discovered version and normalize server URL\r
-        mDiscoveredVersion = operation.getDiscoveredVersion();\r
-        mHostBaseUrl = mHostUrlInput.getText().toString().trim();\r
-        if (!mHostBaseUrl.toLowerCase().startsWith("http://") &&\r
-            !mHostBaseUrl.toLowerCase().startsWith("https://")) {\r
+        return (url != null ? url : "");\r
+    }\r
+\r
+    /**\r
+     * Chooses the right icon and text to show to the user for the received operation result.\r
+     * \r
+     * @param result    Result of a remote operation performed in this activity\r
+     */\r
+    private void updateServerStatusIconAndText(RemoteOperationResult result) {\r
+        mServerStatusIcon = R.drawable.common_error;    // the most common case in the switch below\r
+\r
+        switch (result.getCode()) {\r
+        case OK_SSL:\r
+            mServerStatusIcon = android.R.drawable.ic_secure;\r
+            mServerStatusText = R.string.auth_secure_connection;\r
+            break;\r
             \r
-            if (mIsSslConn) {\r
-                mHostBaseUrl = "https://" + mHostBaseUrl;\r
+        case OK_NO_SSL:\r
+        case OK:\r
+            if (mHostUrlInput.getText().toString().trim().toLowerCase().startsWith("http://") ) {\r
+                mServerStatusText = R.string.auth_connection_established;\r
+                mServerStatusIcon = R.drawable.ic_ok;\r
             } else {\r
-                mHostBaseUrl = "http://" + mHostBaseUrl;\r
+                mServerStatusText = R.string.auth_nossl_plain_ok_title;\r
+                mServerStatusIcon = android.R.drawable.ic_partial_secure;\r
             }\r
+            break;\r
             \r
+        case NO_NETWORK_CONNECTION:\r
+            mServerStatusIcon = R.drawable.no_network;\r
+            mServerStatusText = R.string.auth_no_net_conn_title;\r
+            break;\r
+            \r
+        case SSL_RECOVERABLE_PEER_UNVERIFIED:\r
+            mServerStatusText = R.string.auth_ssl_unverified_server_title;\r
+            break;\r
+        case BAD_OC_VERSION:\r
+            mServerStatusText = R.string.auth_bad_oc_version_title;\r
+            break;\r
+        case WRONG_CONNECTION:\r
+            mServerStatusText = R.string.auth_wrong_connection_title;\r
+            break;\r
+        case TIMEOUT:\r
+            mServerStatusText = R.string.auth_timeout_title;\r
+            break;\r
+        case INCORRECT_ADDRESS:\r
+            mServerStatusText = R.string.auth_incorrect_address_title;\r
+            break;\r
+        case SSL_ERROR:\r
+            mServerStatusText = R.string.auth_ssl_general_error_title;\r
+            break;\r
+        case UNAUTHORIZED:\r
+            mServerStatusText = R.string.auth_unauthorized;\r
+            break;\r
+        case HOST_NOT_AVAILABLE:\r
+            mServerStatusText = R.string.auth_unknown_host_title;\r
+            break;\r
+        case INSTANCE_NOT_CONFIGURED:\r
+            mServerStatusText = R.string.auth_not_configured_title;\r
+            break;\r
+        case FILE_NOT_FOUND:\r
+            mServerStatusText = R.string.auth_incorrect_path_title;\r
+            break;\r
+        case OAUTH2_ERROR:\r
+            mServerStatusText = R.string.auth_oauth_error;\r
+            break;\r
+        case OAUTH2_ERROR_ACCESS_DENIED:\r
+            mServerStatusText = R.string.auth_oauth_error_access_denied;\r
+            break;\r
+        case UNHANDLED_HTTP_CODE:\r
+        case UNKNOWN_ERROR:\r
+            mServerStatusText = R.string.auth_unknown_error_title;\r
+            break;\r
+        default:\r
+            mServerStatusText = 0;\r
+            mServerStatusIcon = 0;\r
         }\r
-        if (mHostBaseUrl.endsWith("/"))\r
-            mHostBaseUrl = mHostBaseUrl.substring(0, mHostBaseUrl.length() - 1);\r
-        \r
-        /// allow or not the user try to access the server\r
-        mOkButton.setEnabled(mStatusCorrect);\r
     }\r
 \r
 \r
@@ -613,89 +727,74 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
      * \r
      * @param result    Result of a remote operation performed in this activity\r
      */\r
-    private void updateStatusIconAndText(RemoteOperationResult result) {\r
-        mStatusText = mStatusIcon = 0;\r
+    private void updateAuthStatusIconAndText(RemoteOperationResult result) {\r
+        mAuthStatusIcon = R.drawable.common_error;    // the most common case in the switch below\r
 \r
         switch (result.getCode()) {\r
         case OK_SSL:\r
-            mStatusIcon = android.R.drawable.ic_secure;\r
-            mStatusText = R.string.auth_secure_connection;\r
+            mAuthStatusIcon = android.R.drawable.ic_secure;\r
+            mAuthStatusText = R.string.auth_secure_connection;\r
             break;\r
             \r
         case OK_NO_SSL:\r
         case OK:\r
             if (mHostUrlInput.getText().toString().trim().toLowerCase().startsWith("http://") ) {\r
-                mStatusText = R.string.auth_connection_established;\r
-                mStatusIcon = R.drawable.ic_ok;\r
+                mAuthStatusText = R.string.auth_connection_established;\r
+                mAuthStatusIcon = R.drawable.ic_ok;\r
             } else {\r
-                mStatusText = R.string.auth_nossl_plain_ok_title;\r
-                mStatusIcon = android.R.drawable.ic_partial_secure;\r
+                mAuthStatusText = R.string.auth_nossl_plain_ok_title;\r
+                mAuthStatusIcon = android.R.drawable.ic_partial_secure;\r
             }\r
             break;\r
             \r
+        case NO_NETWORK_CONNECTION:\r
+            mAuthStatusIcon = R.drawable.no_network;\r
+            mAuthStatusText = R.string.auth_no_net_conn_title;\r
+            break;\r
+            \r
         case SSL_RECOVERABLE_PEER_UNVERIFIED:\r
-            mStatusIcon = R.drawable.common_error;\r
-            mStatusText = R.string.auth_ssl_unverified_server_title;\r
+            mAuthStatusText = R.string.auth_ssl_unverified_server_title;\r
             break;\r
-                \r
         case BAD_OC_VERSION:\r
-            mStatusIcon = R.drawable.common_error;\r
-            mStatusText = R.string.auth_bad_oc_version_title;\r
+            mAuthStatusText = R.string.auth_bad_oc_version_title;\r
             break;\r
         case WRONG_CONNECTION:\r
-            mStatusIcon = R.drawable.common_error;\r
-            mStatusText = R.string.auth_wrong_connection_title;\r
+            mAuthStatusText = R.string.auth_wrong_connection_title;\r
             break;\r
         case TIMEOUT:\r
-            mStatusIcon = R.drawable.common_error;\r
-            mStatusText = R.string.auth_timeout_title;\r
+            mAuthStatusText = R.string.auth_timeout_title;\r
             break;\r
         case INCORRECT_ADDRESS:\r
-            mStatusIcon = R.drawable.common_error;\r
-            mStatusText = R.string.auth_incorrect_address_title;\r
+            mAuthStatusText = R.string.auth_incorrect_address_title;\r
             break;\r
-            \r
         case SSL_ERROR:\r
-            mStatusIcon = R.drawable.common_error;\r
-            mStatusText = R.string.auth_ssl_general_error_title;\r
+            mAuthStatusText = R.string.auth_ssl_general_error_title;\r
             break;\r
-            \r
         case UNAUTHORIZED:\r
-            mStatusIcon = R.drawable.common_error;\r
-            mStatusText = R.string.auth_unauthorized;\r
+            mAuthStatusText = R.string.auth_unauthorized;\r
             break;\r
         case HOST_NOT_AVAILABLE:\r
-            mStatusIcon = R.drawable.common_error;\r
-            mStatusText = R.string.auth_unknown_host_title;\r
-            break;\r
-        case NO_NETWORK_CONNECTION:\r
-            mStatusIcon = R.drawable.no_network;\r
-            mStatusText = R.string.auth_no_net_conn_title;\r
+            mAuthStatusText = R.string.auth_unknown_host_title;\r
             break;\r
         case INSTANCE_NOT_CONFIGURED:\r
-            mStatusIcon = R.drawable.common_error;\r
-            mStatusText = R.string.auth_not_configured_title;\r
+            mAuthStatusText = R.string.auth_not_configured_title;\r
             break;\r
         case FILE_NOT_FOUND:\r
-            mStatusIcon = R.drawable.common_error;\r
-            mStatusText = R.string.auth_incorrect_path_title;\r
+            mAuthStatusText = R.string.auth_incorrect_path_title;\r
             break;\r
         case OAUTH2_ERROR:\r
-            mStatusIcon = R.drawable.common_error;\r
-            mStatusText = R.string.auth_oauth_error;\r
+            mAuthStatusText = R.string.auth_oauth_error;\r
             break;\r
         case OAUTH2_ERROR_ACCESS_DENIED:\r
-            mStatusIcon = R.drawable.common_error;\r
-            mStatusText = R.string.auth_oauth_error_access_denied;\r
+            mAuthStatusText = R.string.auth_oauth_error_access_denied;\r
             break;\r
         case UNHANDLED_HTTP_CODE:\r
         case UNKNOWN_ERROR:\r
-            mStatusIcon = R.drawable.common_error;\r
-            mStatusText = R.string.auth_unknown_error_title;\r
+            mAuthStatusText = R.string.auth_unknown_error_title;\r
             break;\r
-            \r
         default:\r
-            break;\r
+            mAuthStatusText = 0;\r
+            mAuthStatusIcon = 0;\r
         }\r
     }\r
 \r
@@ -728,8 +827,8 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
             mAuthCheckOperation.execute(client, this, mHandler);\r
             \r
         } else {\r
-            updateStatusIconAndText(result);\r
-            updateAuthStatus();\r
+            updateAuthStatusIconAndText(result);\r
+            showAuthStatus();\r
             Log_OC.d(TAG, "Access failed: " + result.getLogMessage());\r
         }\r
     }\r
@@ -763,8 +862,8 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
             finish();\r
             \r
         } else {\r
-            updateStatusIconAndText(result);\r
-            updateAuthStatus();\r
+            updateAuthStatusIconAndText(result);\r
+            showAuthStatus();\r
             Log_OC.d(TAG, "Access failed: " + result.getLogMessage());\r
         }\r
     }\r
@@ -963,19 +1062,18 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
      * Updates the content and visibility state of the icon and text associated\r
      * to the last check on the ownCloud server.\r
      */\r
-    private void updateConnStatus() {\r
-        ImageView iv = (ImageView) findViewById(R.id.action_indicator);\r
-        TextView tv = (TextView) findViewById(R.id.status_text);\r
+    private void showServerStatus() {\r
+        TextView tv = (TextView) findViewById(R.id.server_status_text);\r
 \r
-        if (mStatusIcon == 0 && mStatusText == 0) {\r
-            iv.setVisibility(View.INVISIBLE);\r
+        if (mServerStatusIcon == 0 && mServerStatusText == 0) {\r
             tv.setVisibility(View.INVISIBLE);\r
+            \r
         } else {\r
-            iv.setImageResource(mStatusIcon);\r
-            tv.setText(mStatusText);\r
-            iv.setVisibility(View.VISIBLE);\r
+            tv.setText(mServerStatusText);\r
+            tv.setCompoundDrawablesWithIntrinsicBounds(mServerStatusIcon, 0, 0, 0);\r
             tv.setVisibility(View.VISIBLE);\r
         }\r
+        \r
     }\r
     \r
     \r
@@ -983,17 +1081,26 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
      * Updates the content and visibility state of the icon and text associated\r
      * to the interactions with the OAuth authorization server.\r
      */\r
-    private void updateAuthStatus() {\r
-        if (mStatusIcon == 0 && mStatusText == 0) {\r
+    private void showAuthStatus() {\r
+        if (mAuthStatusIcon == 0 && mAuthStatusText == 0) {\r
             mAuthStatusLayout.setVisibility(View.INVISIBLE);\r
+            \r
         } else {\r
-            mAuthStatusLayout.setText(mStatusText);\r
-            mAuthStatusLayout.setCompoundDrawablesWithIntrinsicBounds(mStatusIcon, 0, 0, 0);\r
+            mAuthStatusLayout.setText(mAuthStatusText);\r
+            mAuthStatusLayout.setCompoundDrawablesWithIntrinsicBounds(mAuthStatusIcon, 0, 0, 0);\r
             mAuthStatusLayout.setVisibility(View.VISIBLE);\r
         }\r
     }     \r
 \r
     \r
+    private void showRefreshButton() {\r
+        mHostUrlInput.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_action_refresh_black, 0);\r
+    }\r
+    \r
+    private void hideRefreshButton() {\r
+        mHostUrlInput.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);\r
+    }\r
+    \r
     /**\r
      * Called when the refresh button in the input field for ownCloud host is clicked.\r
      * \r
@@ -1002,7 +1109,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
      * @param view      Refresh 'button'\r
      */\r
     public void onRefreshClick(View view) {\r
-        onFocusChange(mRefreshButton, false);\r
+        checkOcServer();\r
     }\r
     \r
     \r
@@ -1082,4 +1189,56 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
         showDialog(DIALOG_CERT_NOT_SAVED);\r
     }\r
 \r
+\r
+    /**\r
+     *  Called when the 'action' button in an IME is pressed ('enter' in software keyboard).\r
+     * \r
+     *  Used to trigger the authorization check when the user presses 'enter' after writing the password.\r
+     */\r
+    @Override\r
+    public boolean onEditorAction(TextView inputField, int actionId, KeyEvent event) {\r
+        if (inputField != null && inputField.equals(mPasswordInput) && \r
+                actionId == EditorInfo.IME_ACTION_DONE) {\r
+            if (mOkButton.isEnabled()) {\r
+                mOkButton.performClick();\r
+            }\r
+        }\r
+        return false;   // always return false to grant that the software keyboard is hidden anyway\r
+    }\r
+\r
+    \r
+    private abstract static class RightDrawableOnTouchListener implements OnTouchListener  {\r
+\r
+        private int fuzz = 10;\r
+        \r
+        /**\r
+         * {@inheritDoc}\r
+         */\r
+        @Override\r
+        public boolean onTouch(View view, MotionEvent event) {\r
+            if (event.getAction() == MotionEvent.ACTION_DOWN) {\r
+                Drawable rightDrawable = null;\r
+                if (view instanceof TextView) {\r
+                    Drawable[] drawables = ((TextView)view).getCompoundDrawables();\r
+                    if (drawables.length > 2) {\r
+                        rightDrawable = drawables[2];\r
+                    }\r
+                }\r
+                if (rightDrawable != null) {\r
+                    final int x = (int) event.getX();\r
+                    final int y = (int) event.getY();\r
+                    final Rect bounds = rightDrawable.getBounds();\r
+                    if (x >= (view.getRight() - bounds.width() - fuzz) && x <= (view.getRight() - view.getPaddingRight() + fuzz)\r
+                        && y >= (view.getPaddingTop() - fuzz) && y <= (view.getHeight() - view.getPaddingBottom()) + fuzz) {\r
+                        \r
+                        return onDrawableTouch(event);\r
+                    }\r
+                }\r
+            }\r
+            return false;\r
+        }\r
+        \r
+        public abstract boolean onDrawableTouch(final MotionEvent event);\r
+    }\r
+    \r
 }\r