[Libreoffice-commits] online.git: Branch 'distro/collabora/co-4-2' - android/app
Jan Holesovsky (via logerrit)
logerrit at kemper.freedesktop.org
Thu Aug 6 13:41:44 UTC 2020
android/app/src/main/java/org/libreoffice/androidapp/ui/LibreOfficeUIActivity.java | 103 ++++------
android/app/src/main/res/layout/activity_document_browser.xml | 1
2 files changed, 45 insertions(+), 59 deletions(-)
New commits:
commit 3fc3af072074efbebe8763b4cdff21ade8915eb3
Author: Jan Holesovsky <kendy at collabora.com>
AuthorDate: Thu Aug 6 14:41:37 2020 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Aug 6 15:41:25 2020 +0200
android: Make the "create new file" FAB always visible.
There were reports that it didn't appear after a new installation.
I failed to reproduce that, but I can imagine it might have happened,
seeing the code. But it is not important to hide it any more, because
we are using the Content providers now.
When at this, make the FAB rotate the other direction, to look more
consistent with the appearing / disappearing buttons.
Change-Id: I92e01c7190405c2d4869edd50a9da011558306af
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/100246
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Jan Holesovsky <kendy at collabora.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 e89913628..80e5efeb6 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
@@ -442,7 +442,7 @@ public class LibreOfficeUIActivity extends AppCompatActivity implements Settings
if (isFabMenuOpen)
return;
- ViewCompat.animate(editFAB).rotation(45f).withLayer().setDuration(300).setInterpolator(new OvershootInterpolator(0f)).start();
+ ViewCompat.animate(editFAB).rotation(-45f).withLayer().setDuration(300).setInterpolator(new OvershootInterpolator(0f)).start();
impressLayout.startAnimation(fabOpenAnimation);
writerLayout.startAnimation(fabOpenAnimation);
calcLayout.startAnimation(fabOpenAnimation);
@@ -929,8 +929,6 @@ public class LibreOfficeUIActivity extends AppCompatActivity implements Settings
ActivityCompat.requestPermissions(this,
new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
PERMISSION_WRITE_EXTERNAL_STORAGE);
- } else {
- setEditFABVisibility(View.VISIBLE);
}
Log.d(LOGTAG, "onStart");
}
@@ -1038,65 +1036,54 @@ public class LibreOfficeUIActivity extends AppCompatActivity implements Settings
}
}
- private void setEditFABVisibility(final int visibility) {
- LibreOfficeApplication.getMainHandler().post(new Runnable() {
- @Override
- public void run() {
- editFAB.setVisibility(visibility);
- }
- });
- }
-
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
switch (requestCode) {
case PERMISSION_WRITE_EXTERNAL_STORAGE:
- if (permissions.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
- setEditFABVisibility(View.VISIBLE);
- } else {
- setEditFABVisibility(View.INVISIBLE);
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
- boolean showRationale = shouldShowRequestPermissionRationale(Manifest.permission.WRITE_EXTERNAL_STORAGE);
- androidx.appcompat.app.AlertDialog.Builder rationaleDialogBuilder = new androidx.appcompat.app.AlertDialog.Builder(this)
- .setCancelable(false)
- .setTitle(getString(R.string.title_permission_required))
- .setMessage(getString(R.string.reason_required_to_read_documents));
- if (showRationale) {
- rationaleDialogBuilder.setPositiveButton(getString(R.string.positive_ok), new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- ActivityCompat.requestPermissions(LibreOfficeUIActivity.this,
- new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
- PERMISSION_WRITE_EXTERNAL_STORAGE);
- }
- })
- .setNegativeButton(getString(R.string.negative_im_sure), new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- LibreOfficeUIActivity.this.finish();
- }
- })
- .create()
- .show();
- } else {
- rationaleDialogBuilder.setPositiveButton(getString(R.string.positive_ok), new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
- Uri uri = Uri.fromParts("package", getPackageName(), null);
- intent.setData(uri);
- startActivity(intent);
- }
- })
- .setNegativeButton(R.string.negative_cancel, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- LibreOfficeUIActivity.this.finish();
- }
- })
- .create()
- .show();
- }
+ if (permissions.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED)
+ return;
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+ boolean showRationale = shouldShowRequestPermissionRationale(Manifest.permission.WRITE_EXTERNAL_STORAGE);
+ androidx.appcompat.app.AlertDialog.Builder rationaleDialogBuilder = new androidx.appcompat.app.AlertDialog.Builder(this)
+ .setCancelable(false)
+ .setTitle(getString(R.string.title_permission_required))
+ .setMessage(getString(R.string.reason_required_to_read_documents));
+ if (showRationale) {
+ rationaleDialogBuilder.setPositiveButton(getString(R.string.positive_ok), new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ ActivityCompat.requestPermissions(LibreOfficeUIActivity.this,
+ new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
+ PERMISSION_WRITE_EXTERNAL_STORAGE);
+ }
+ })
+ .setNegativeButton(getString(R.string.negative_im_sure), new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ LibreOfficeUIActivity.this.finish();
+ }
+ })
+ .create()
+ .show();
+ } else {
+ rationaleDialogBuilder.setPositiveButton(getString(R.string.positive_ok), new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
+ Uri uri = Uri.fromParts("package", getPackageName(), null);
+ intent.setData(uri);
+ startActivity(intent);
+ }
+ })
+ .setNegativeButton(R.string.negative_cancel, new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ LibreOfficeUIActivity.this.finish();
+ }
+ })
+ .create()
+ .show();
}
}
break;
diff --git a/android/app/src/main/res/layout/activity_document_browser.xml b/android/app/src/main/res/layout/activity_document_browser.xml
index e7ac16548..4ab69a188 100644
--- a/android/app/src/main/res/layout/activity_document_browser.xml
+++ b/android/app/src/main/res/layout/activity_document_browser.xml
@@ -134,7 +134,6 @@
android:layout_height="wrap_content"
android:clickable="true"
android:focusable="true"
- android:visibility="invisible"
app:backgroundTint="@color/background_normal"
app:fabSize="normal"
app:layout_constraintBottom_toBottomOf="parent"
More information about the Libreoffice-commits
mailing list