[Libreoffice-commits] online.git: android/app

Ashod Nakashian (via logerrit) logerrit at kemper.freedesktop.org
Tue Feb 18 14:01:46 UTC 2020


 android/app/src/main/java/org/libreoffice/androidapp/ui/LibreOfficeUIActivity.java |   10 ++++++++++
 1 file changed, 10 insertions(+)

New commits:
commit 8c26be1ee75a0c34a46859de14e331c53e457e1b
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Mon Feb 17 14:27:05 2020 -0500
Commit:     Ashod Nakashian <ashnakash at gmail.com>
CommitDate: Tue Feb 18 15:01:27 2020 +0100

    android: hide the keyboard after creating new doc
    
    Also, when cancelling the new doc creation.
    
    Change-Id: Ia84eae1f69c6018b98437327cdc67a923632b3dd
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/88883
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/android/app/src/main/java/org/libreoffice/androidapp/ui/LibreOfficeUIActivity.java b/android/app/src/main/java/org/libreoffice/androidapp/ui/LibreOfficeUIActivity.java
index b40c3120f..0b2ad0355 100644
--- a/android/app/src/main/java/org/libreoffice/androidapp/ui/LibreOfficeUIActivity.java
+++ b/android/app/src/main/java/org/libreoffice/androidapp/ui/LibreOfficeUIActivity.java
@@ -603,6 +603,9 @@ public class LibreOfficeUIActivity extends AppCompatActivity implements Settings
         input.setSelection(0, input.getText().toString().lastIndexOf('.'));
         input.requestFocus();
         InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
+
+        // We should just focus on the input EditText so the keyboard would hide automatically.
+        // imm.showSoftInput(input,0); Should be enough, alas this is the wrong place, so doesn't work.
         imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,0);
 
         // warning text to notify the user that such a file already exists
@@ -618,6 +621,9 @@ public class LibreOfficeUIActivity extends AppCompatActivity implements Settings
             .setPositiveButton(tempFile.exists() ? R.string.action_overwrite : R.string.action_create, new DialogInterface.OnClickListener() {
                 @Override
                 public void onClick(DialogInterface dialog, int which) {
+                    // Hide the keyboard, which we show forcefully.
+                    imm.hideSoftInputFromWindow(input.getWindowToken(), 0);
+
                     final String path = currentDirectory.getUri().getPath() + input.getText().toString();
                     Uri newDocUri = createNewFile(path, extension);
                     if (newDocUri != null) {
@@ -639,6 +645,10 @@ public class LibreOfficeUIActivity extends AppCompatActivity implements Settings
             .setNegativeButton(R.string.action_cancel, new DialogInterface.OnClickListener() {
                 @Override
                 public void onClick(DialogInterface dialog, int which) {
+
+                    // Hide the keyboard, which we show forcefully.
+                    imm.hideSoftInputFromWindow(input.getWindowToken(), 0);
+
                     dialog.cancel();
                 }
             });


More information about the Libreoffice-commits mailing list