android/source/lint-baseline.xml | 19 +------ android/source/res/layout/activity_main.xml | 2 android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java | 25 ++++++---- 3 files changed, 20 insertions(+), 26 deletions(-)
New commits: commit 5410178db099a2dbd0ff094e1e26848a013b8ecc Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Wed Jul 9 14:42:02 2025 +0200 Commit: Adolfo Jayme Barrientos <fit...@ubuntu.com> CommitDate: Mon Jul 14 19:05:56 2025 +0200 android lint: Always have Calc doc right of headers Address these 2 lint warnings which would otherwise trigger build errors in a WIP branch updating compileSdkVersion and targetSdkVersion to 36. <issue id="RtlHardcoded" message="Redundant attribute `layout_toRightOf`; already defining `layout_toEndOf` with `targetSdkVersion` 34" errorLine1=" android:layout_toRightOf="@+id/calc_header_top_left"" errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~"> <location file="res/layout/activity_main.xml" line="78" column="21"/> </issue> <issue id="RtlHardcoded" message="Redundant attribute `layout_toRightOf`; already defining `layout_toEndOf` with `targetSdkVersion` 34" errorLine1=" android:layout_toRightOf="@+id/calc_header_row"" errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~"> <location file="res/layout/activity_main.xml" line="94" column="21"/> </issue> Like the desktop version of LibreOffice, have the Calc doc always to the right of the headers, regardless of whether RTL or LTR is used, i.e. leave `android:layout_toRightOf` and drop the `layout_toEndOf` attribute. this triggers other lint warnings. Regenerate android/source/lint-baseline.xml to not fail the build on those. Change-Id: I4b3c1076d62a757164a3ae1953fe0c73ddc444c5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187574 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> (cherry picked from commit bda2ac31eeea60ca3e8a5b6057ee554df562f6d5) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187688 Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com> diff --git a/android/source/lint-baseline.xml b/android/source/lint-baseline.xml index 5888d2327d22..12594c48345e 100644 --- a/android/source/lint-baseline.xml +++ b/android/source/lint-baseline.xml @@ -111,17 +111,6 @@ column="79"/> </issue> - <issue - id="GradleDependency" - message="A newer version of androidx.constraintlayout:constraintlayout than 2.2.0 is available: 2.2.1" - errorLine1=" implementation 'androidx.constraintlayout:constraintlayout:2.2.0'" - errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> - <location - file="build.gradle" - line="36" - column="20"/> - </issue> - <issue id="GradleDependency" message="A newer version of `compileSdkVersion` than 34 is available: 36" @@ -1381,7 +1370,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> <location file="src/java/org/libreoffice/ui/LibreOfficeUIActivity.java" - line="408" + line="415" column="13"/> </issue> @@ -2135,7 +2124,7 @@ <issue id="RtlHardcoded" - message="Redundant attribute `layout_toRightOf`; already defining `layout_toEndOf` with `targetSdkVersion` 34" + message="Consider replacing `android:layout_toRightOf` with `android:layout_toEndOf="@+id/calc_header_top_left"` to better support right-to-left layouts" errorLine1=" android:layout_toRightOf="@+id/calc_header_top_left"" errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~"> <location @@ -2146,12 +2135,12 @@ <issue id="RtlHardcoded" - message="Redundant attribute `layout_toRightOf`; already defining `layout_toEndOf` with `targetSdkVersion` 34" + message="Consider replacing `android:layout_toRightOf` with `android:layout_toEndOf="@+id/calc_header_row"` to better support right-to-left layouts" errorLine1=" android:layout_toRightOf="@+id/calc_header_row"" errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~"> <location file="res/layout/activity_main.xml" - line="94" + line="93" column="21"/> </issue> diff --git a/android/source/res/layout/activity_main.xml b/android/source/res/layout/activity_main.xml index e503cb90f0eb..f2caccdf12c3 100644 --- a/android/source/res/layout/activity_main.xml +++ b/android/source/res/layout/activity_main.xml @@ -76,7 +76,6 @@ android:layout_width="match_parent" android:layout_height="@dimen/calc_header_height" android:layout_toRightOf="@+id/calc_header_top_left" - android:layout_toEndOf="@+id/calc_header_top_left" android:visibility="gone"/> <org.libreoffice.overlay.CalcHeadersView @@ -92,7 +91,6 @@ android:layout_height="match_parent" android:orientation="vertical" android:layout_toRightOf="@+id/calc_header_row" - android:layout_toEndOf="@+id/calc_header_row" android:layout_below="@+id/calc_header_column"> <org.mozilla.gecko.gfx.LayerView commit aab5432c05efb9cbfcbb5627ef46540f78bc37c5 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Wed Jul 9 14:21:08 2025 +0200 Commit: Adolfo Jayme Barrientos <fit...@ubuntu.com> CommitDate: Mon Jul 14 19:05:44 2025 +0200 android: Port from deprecated ComponentActivity.onBackPressed (II) Port LibreOfficeUIActivity from overriding the deprecated androidx.ComponentActivity.onBackPressed method [1] and register a androidx.activity.OnBackPressedCallback [2]. Overriding the deprecated API was already triggering a warning and that was turned into a build/lint error in a WIP branch updating the compileSdkVersion and targetSdkVersion to 36. Interaction when using the back button (or gesture) remains the same after enabling experimental editing option and clicking the "+" button to display the options to create new filesin a quick test (with an additional local revert of commit 9d1e76f7da12353afc3d9479d3b2ecddbb2a71e6 to prevent a deadlock when opening documents that is unrelated to this change here). [1] https://developer.android.com/reference/androidx/activity/ComponentActivity#onBackPressed() [2] https://developer.android.com/reference/androidx/activity/OnBackPressedCallback Change-Id: Ie5e9f3be7321d40f43ebf584db367432afb70577 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187573 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> (cherry picked from commit 354c70556b5656c586adf4c8cc0521687bd77e22) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187687 Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com> diff --git a/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java b/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java index 3f93d815af27..69bf430dd6b0 100644 --- a/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java +++ b/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java @@ -22,6 +22,8 @@ import android.graphics.drawable.Icon; import android.net.Uri; import android.os.Bundle; import com.google.android.material.floatingactionbutton.FloatingActionButton; + +import androidx.activity.OnBackPressedCallback; import androidx.core.app.ActivityCompat; import androidx.core.content.ContextCompat; import androidx.core.view.ViewCompat; @@ -142,6 +144,20 @@ public class LibreOfficeUIActivity extends AppCompatActivity implements View.OnC createUI(); fabOpenAnimation = AnimationUtils.loadAnimation(this, R.anim.fab_open); fabCloseAnimation = AnimationUtils.loadAnimation(this, R.anim.fab_close); + + getOnBackPressedDispatcher().addCallback(new OnBackPressedCallback(true) { + @Override + public void handleOnBackPressed() { + if (isFabMenuOpen) { + collapseFabMenu(); + return; + } else { + setEnabled(false); + getOnBackPressedDispatcher().onBackPressed(); + setEnabled(true); + } + } + }); } @Override @@ -234,15 +250,6 @@ public class LibreOfficeUIActivity extends AppCompatActivity implements View.OnC isFabMenuOpen = false; } - @Override - public void onBackPressed() { - if (isFabMenuOpen) { - collapseFabMenu(); - } else { - super.onBackPressed(); - } - } - @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data);