From 638b2c7eda0145df45a9398a4af30716eadcc1d0 Mon Sep 17 00:00:00 2001 From: mert Date: Tue, 17 Dec 2019 11:38:28 +0000 Subject: [PATCH] Preselect the new document textbox on creation This way it is easier to delete the text and enter a new one Change-Id: I98c28ed8782f8546ceca464e0dae6b8a637db198 Reviewed-on: https://gerrit.libreoffice.org/85295 Tested-by: Jenkins CollaboraOffice Reviewed-by: Michael Meeks --- .../libreoffice/androidapp/ui/LibreOfficeUIActivity.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 60273b622..2317d42ad 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 @@ -28,7 +28,6 @@ import android.net.Uri; import android.os.AsyncTask; import android.os.Build; import android.os.Bundle; -import android.os.Handler; import android.preference.PreferenceManager; import android.provider.Settings; import android.text.Editable; @@ -47,6 +46,7 @@ import android.view.ViewGroup; import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.view.animation.OvershootInterpolator; +import android.view.inputmethod.InputMethodManager; import android.widget.Button; import android.widget.EditText; import android.widget.ImageView; @@ -593,6 +593,10 @@ public class LibreOfficeUIActivity extends AppCompatActivity implements Settings // file name input final EditText input = (EditText)view.findViewById(R.id.fileName); input.setText(defaultFileName); + input.setSelection(0, input.getText().toString().lastIndexOf('.')); + input.requestFocus(); + InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); + imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,0); // warning text to notify the user that such a file already exists final TextView warningText = (TextView)view.findViewById(R.id.overwriteWarning);