]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
wpadebug: Close InputUri activity automatically on DPP URI completion
authorJouni Malinen <jouni@codeaurora.org>
Thu, 22 Feb 2018 12:40:47 +0000 (14:40 +0200)
committerJouni Malinen <j@w1.fi>
Thu, 22 Feb 2018 12:55:03 +0000 (14:55 +0200)
Check the entered text and stop automatically at the end of full DPP
URI.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
wpadebug/src/w1/fi/wpadebug/InputUri.java

index a7c51313ad4df7b8818ce654a772c5464e5793bd..ea1fa99d2a3e100d3036e27f5df9c514c624eb97 100644 (file)
@@ -10,6 +10,8 @@ package w1.fi.wpadebug;
 
 import android.app.Activity;
 import android.os.Bundle;
+import android.text.Editable;
+import android.text.TextWatcher;
 import android.view.View;
 import android.widget.Button;
 import android.widget.EditText;
@@ -34,6 +36,28 @@ public class InputUri extends Activity {
         setContentView(R.layout.input_uri);
         mEditText = (EditText)findViewById(R.id.edit_uri);
         mSubmitButton = (Button)findViewById(R.id.submit_uri);
+
+       mEditText.addTextChangedListener(new TextWatcher() {
+               @Override
+               public void onTextChanged(CharSequence s, int start, int before,
+                                         int count) {
+                   mUriText = mEditText.getText().toString();
+                   if (mUriText.startsWith("DPP:") &&
+                       mUriText.endsWith(";;")) {
+                       writeToFile(mUriText);
+                       finish();
+                   }
+               }
+
+               @Override
+               public void beforeTextChanged(CharSequence s, int start,
+                                             int count, int after) {
+               }
+
+               @Override
+               public void afterTextChanged(Editable s) {
+               }
+           });
     }
 
     @Override