Commit 9a5fcdd9 authored by luca020400's avatar luca020400

Jelly: Search on Enter key

* Sent by external keyboards

Change-Id: Id87eacd6e4beace07d5048c451474f4c4df825b6
parent 74c7e51a
......@@ -51,6 +51,7 @@ import android.util.Log;
import android.view.ContextThemeWrapper;
import android.view.GestureDetector;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
......@@ -136,6 +137,19 @@ public class MainActivity extends WebViewExtActivity implements View.OnTouchList
}
return false;
});
editText.setOnKeyListener((v, keyCode, event) -> {
if (keyCode == KeyEvent.KEYCODE_ENTER) {
InputMethodManager manager = (InputMethodManager)
getSystemService(Context.INPUT_METHOD_SERVICE);
manager.hideSoftInputFromWindow(
editText.getApplicationWindowToken(), 0);
mWebView.loadUrl(editText.getText().toString());
editText.clearFocus();
return true;
}
return false;
});
Intent intent = getIntent();
String url = intent.getDataString();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment