From e4c9d68b23a9a58ee040bf748bb3d492350b0ee0 Mon Sep 17 00:00:00 2001 From: Mert Tumer Date: Fri, 3 Aug 2018 07:20:14 -0700 Subject: Fix floating action button disappears after closing a document MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I6afc278908d2afadbf531010ab7e466b9224b9af Signed-off-by: Mert Tumer Reviewed-on: https://gerrit.libreoffice.org/58564 Reviewed-by: Tomaž Vajngerl Tested-by: Tomaž Vajngerl --- .../org/libreoffice/ui/LibreOfficeUIActivity.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'android') diff --git a/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java b/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java index e8809973777f..fd1e2a217b14 100644 --- a/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java +++ b/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java @@ -166,15 +166,7 @@ public class LibreOfficeUIActivity extends AppCompatActivity implements Settings filter.addAction(UsbManager.ACTION_USB_DEVICE_DETACHED); registerReceiver(mUSBReceiver, filter); // init UI and populate with contents from the provider - if (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { - Log.i(LOGTAG, "no permission to read external storage - asking for permission"); - ActivityCompat.requestPermissions(this, - new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, - PERMISSION_READ_EXTERNAL_STORAGE); - } else { - switchToDocumentProvider(documentProviderFactory.getDefaultProvider()); - setEditFABVisibility(View.VISIBLE); - } + createUI(); fabOpenAnimation = AnimationUtils.loadAnimation(this, R.anim.fab_open); @@ -946,6 +938,15 @@ public class LibreOfficeUIActivity extends AppCompatActivity implements Settings @Override protected void onStart() { super.onStart(); + if (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { + Log.i(LOGTAG, "no permission to read external storage - asking for permission"); + ActivityCompat.requestPermissions(this, + new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, + PERMISSION_READ_EXTERNAL_STORAGE); + } else { + switchToDocumentProvider(documentProviderFactory.getDefaultProvider()); + setEditFABVisibility(View.VISIBLE); + } Log.d(LOGTAG, "onStart"); } -- cgit v1.2.3