Make enter advance navigation or sign in

 Bug: 3487066
 Also cleaned up the layout

Change-Id: Iaa471ff8fcd793381cb98416493dcf707cbecc29
diff --git a/src/com/android/browser/HttpAuthenticationDialog.java b/src/com/android/browser/HttpAuthenticationDialog.java
index a9ba332..ac4119c 100644
--- a/src/com/android/browser/HttpAuthenticationDialog.java
+++ b/src/com/android/browser/HttpAuthenticationDialog.java
@@ -18,10 +18,13 @@
 import android.app.AlertDialog;
 import android.content.Context;
 import android.content.DialogInterface;
+import android.view.KeyEvent;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.WindowManager;
+import android.view.inputmethod.EditorInfo;
 import android.widget.TextView;
+import android.widget.TextView.OnEditorActionListener;
 
 /**
  * HTTP authentication dialog.
@@ -109,6 +112,16 @@
         View v = factory.inflate(R.layout.http_authentication, null);
         mUsernameView = (TextView) v.findViewById(R.id.username_edit);
         mPasswordView = (TextView) v.findViewById(R.id.password_edit);
+        mPasswordView.setOnEditorActionListener(new OnEditorActionListener() {
+            @Override
+            public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
+                if (actionId == EditorInfo.IME_ACTION_DONE) {
+                    mDialog.getButton(AlertDialog.BUTTON_POSITIVE).performClick();
+                    return true;
+                }
+                return false;
+            }
+        });
 
         String title = mContext.getText(R.string.sign_in_to).toString().replace(
                 "%s1", mHost).replace("%s2", mRealm);