jenkins-bot has submitted this change and it was merged.

Change subject: Make enter key submit request when the user is filling in a 
captcha.
......................................................................


Make enter key submit request when the user is filling in a captcha.

Since the captcha form requires only a single input (i.e. the captcha),
this patch makes the enter key on the keyboard submit the form rather
than simply collapsing the keyboard.

This patch also slightly tweaks the ordering of the XML for the captcha
group, so that the android:id is at the top, which is our prevailing
style.

Bug: T95145
Change-Id: I68d37d8dd28a2a9c4741633cb646259b07c7cb6b
---
M wikipedia/res/layout/group_captcha.xml
M wikipedia/src/main/java/org/wikipedia/createaccount/CreateAccountActivity.java
2 files changed, 14 insertions(+), 2 deletions(-)

Approvals:
  BearND: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/wikipedia/res/layout/group_captcha.xml 
b/wikipedia/res/layout/group_captcha.xml
index e031a40..8c69112 100644
--- a/wikipedia/res/layout/group_captcha.xml
+++ b/wikipedia/res/layout/group_captcha.xml
@@ -44,12 +44,12 @@
             android:gravity="center"
             />
     <org.wikipedia.views.PlainPasteEditText
+            android:id="@+id/captcha_text"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_margin="16dp"
             style="?android:textAppearanceMedium"
             android:layout_gravity="center_horizontal"
-            android:id="@+id/captcha_text"
             android:hint="@string/edit_section_captcha_hint"
             android:singleLine="true"
             android:inputType="textNoSuggestions"
diff --git 
a/wikipedia/src/main/java/org/wikipedia/createaccount/CreateAccountActivity.java
 
b/wikipedia/src/main/java/org/wikipedia/createaccount/CreateAccountActivity.java
index 19e9c82..1e63596 100644
--- 
a/wikipedia/src/main/java/org/wikipedia/createaccount/CreateAccountActivity.java
+++ 
b/wikipedia/src/main/java/org/wikipedia/createaccount/CreateAccountActivity.java
@@ -5,7 +5,9 @@
 import android.os.Bundle;
 import android.util.Log;
 import android.view.MenuItem;
+import android.view.KeyEvent;
 import android.view.View;
+import android.view.View.OnKeyListener;
 import android.widget.Button;
 import android.widget.CheckBox;
 import android.widget.EditText;
@@ -25,7 +27,6 @@
 import org.wikipedia.*;
 import org.wikipedia.analytics.CreateAccountFunnel;
 import org.wikipedia.editing.CaptchaHandler;
-
 
 public class CreateAccountActivity extends ThemedActionBarActivity {
     public static final int RESULT_ACCOUNT_CREATED = 1;
@@ -166,6 +167,17 @@
             }
         });
 
+        // Add listener so that when the user taps enter, it submits the 
captcha
+        captchaText.setOnKeyListener(new OnKeyListener() {
+            public boolean onKey(View v, int keyCode, KeyEvent event) {
+                if ((event.getAction() == KeyEvent.ACTION_UP) && (keyCode == 
KeyEvent.KEYCODE_ENTER)) {
+                    validator.validate();
+                    return true;
+                }
+                return false;
+            }
+        });
+
         if (savedInstanceState != null && 
savedInstanceState.containsKey("result")) {
             createAccountResult = savedInstanceState.getParcelable("result");
             if (createAccountResult instanceof CreateAccountCaptchaResult) {

-- 
To view, visit https://gerrit.wikimedia.org/r/201989
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I68d37d8dd28a2a9c4741633cb646259b07c7cb6b
Gerrit-PatchSet: 2
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Deskana <dga...@wikimedia.org>
Gerrit-Reviewer: BearND <bsitzm...@wikimedia.org>
Gerrit-Reviewer: Brion VIBBER <br...@wikimedia.org>
Gerrit-Reviewer: Dbrant <dbr...@wikimedia.org>
Gerrit-Reviewer: Deskana <dga...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to