From e05b028fa8e346f496fa6c8aaa244efed97ac31b Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Tue, 23 May 2023 21:07:30 -0500 Subject: [PATCH] Fix keyboard and focus issues for name edit --- .../siacs/conversations/ui/ContactDetailsActivity.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java index c2ab2d018..9f172ef7d 100644 --- a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java @@ -2,6 +2,7 @@ package eu.siacs.conversations.ui; import android.Manifest; import android.content.ActivityNotFoundException; +import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; @@ -18,6 +19,7 @@ import android.text.Spannable; import android.text.SpannableString; import android.text.style.RelativeSizeSpan; import android.util.TypedValue; +import android.view.inputmethod.InputMethodManager; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; @@ -69,6 +71,7 @@ import eu.siacs.conversations.ui.util.GridManager; import eu.siacs.conversations.ui.util.JidDialog; import eu.siacs.conversations.ui.util.MenuDoubleTabUtil; import eu.siacs.conversations.ui.util.ShareUtil; +import eu.siacs.conversations.ui.util.SoftKeyboardUtils; import eu.siacs.conversations.utils.AccountUtils; import eu.siacs.conversations.utils.Compatibility; import eu.siacs.conversations.utils.Emoticons; @@ -202,7 +205,6 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp @Override protected void refreshUiReal() { - invalidateOptionsMenu(); populateView(); } @@ -329,6 +331,10 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp }); text.setText(contact.getServerName()); text.requestFocus(); + InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); + if (imm != null) { + imm.showSoftInput(text, InputMethodManager.SHOW_IMPLICIT); + } binding.tags.setVisibility(View.GONE); binding.editTags.clearSync(); for (final ListItem.Tag group : contact.getGroupTags()) { @@ -413,6 +419,7 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp edit.setOnActionExpandListener(new MenuItem.OnActionExpandListener() { @Override public boolean onMenuItemActionCollapse(MenuItem item) { + SoftKeyboardUtils.hideSoftKeyboard(ContactDetailsActivity.this); binding.editTags.setVisibility(View.GONE); if (save != null) save.setVisible(false); populateView(); -- 2.45.2