Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
Show correct enter key label based on input IME options
Browse files Browse the repository at this point in the history
  • Loading branch information
MortimerGoro committed May 16, 2019
1 parent e64f6d1 commit f07e552
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ public String getEnterKeyText(int aIMEOptions, String aComposingText) {
}
}

@Override
public String getSpaceKeyText(String aComposingText) {
return StringUtils.getStringByLocale(mContext, R.string.keyboard_space_label, getLocale()).toUpperCase();
}

@Override
public String getComposingText(String aComposing, String aCode) {
return aComposing.replaceFirst(Pattern.quote(aCode), "");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public enum Action {
String getComposingText(String aComposing, String aCode);
String getKeyboardTitle();
Locale getLocale();
default String getSpaceKeyText(String aComposingText) { return ""; }
String getSpaceKeyText(String aComposingText);
String getEnterKeyText(int aIMEOptions, String aComposingText);
String getModeChangeKeyText();
}
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ private void initialize(Context aContext) {
mURL = findViewById(R.id.urlEditText);
mURL.setShowSoftInputOnFocus(false);
mURL.setOnEditorActionListener((aTextView, actionId, event) -> {
if (actionId == EditorInfo.IME_ACTION_DONE) {
if (actionId == EditorInfo.IME_ACTION_DONE || actionId == EditorInfo.IME_ACTION_SEARCH
|| actionId == EditorInfo.IME_ACTION_GO || actionId == EditorInfo.IME_ACTION_SEND) {
handleURLEdit(aTextView.getText().toString());
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ public void updateFocusedView(View aFocusedView) {
}

updateCandidates();
updateSpecialKeyLabels();
}

public void dismiss() {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/navigation_url.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
android:fadingEdgeLength="20dp"
android:gravity="center_vertical"
android:hint="@string/search_placeholder"
android:imeOptions="actionDone"
android:imeOptions="actionGo"
android:inputType="textUri"
android:paddingStart="20dp"
android:paddingEnd="80dp"
Expand Down

0 comments on commit f07e552

Please sign in to comment.