Commit Graph

344 Commits

Author SHA1 Message Date
4bba7fbc22 android lint: Add API level check for EXTRA_INITIAL_URI
`DocumentsContract.EXTRA_INITIAL_URI` was added in API level 26,
so only set it conditionally when that API level is avaible.

Change-Id: I6783e89f50354c017968b74cc45fb1a3b6faab83
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160468
Tested-by: Jenkins
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
2023-12-11 19:04:49 +01:00
c2fc2c8c7c android: Bump minSdkVersion to 21 (Android 5.0)
NDK 26 dropped support for API levels < 21 [1] [2].
Do the same for our Android build, to ease the
maintenance.

Adapt configure.ac accordingly and drop the
now obsolete code paths in Android Viewer
Java code.

This in also means that the same minSdkVersion will
be used for all architectures now, while API level 21
was already used for the 64-bit variants (for which
the minimum supported version was 21 anyway) and
API level 19 was used for x86 and 32-bit ARM when
building with NDK 24/25, API level 16 when building
with NDK 23.

According to [1] and [3], more than 99% of
Android devices have at least Android version 5,
i.e. support API level 21.

[1] https://github.com/android/ndk/issues/1751
[2] https://developer.android.com/ndk/downloads/revision_history
[3] https://apilevels.com/

Change-Id: I875e784dd4e62993f51059ae6a280d425cb49c0a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160334
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-12-08 10:39:37 +01:00
35b7aa3a86 android: Separate build ID and vendor from versionName
So far, the versionName for the LibreOffice APK/app bundle
included the build ID and vendor, was e.g.
"24.2.0.0.alpha1+/2972af9045a5/The Document Foundation".

That versionName would be split again to extract the build ID
and vendor to display them in the about dialog.

No longer include build ID and vendor in the `versionName`,
but use separate build config variables, similar to what
is done for the privacy policy.

This slightly simplifies the code for the about dialog.

But more importantly, the previous `versionName` scheme
would make it impossible to automate the F-Droid update
of the app, because the scheme is not compatible with
the expectations of F-Droid's update mechanism, see the
F-Droid merge request to update LibreOffice Viewer to 7.6.3 [1]
for more details, in particular the (eventually not merged)
commit [2] mentioning what manual steps would still be needed
when trying to semi-automate the update at least.

[1] https://gitlab.com/fdroid/fdroiddata/-/merge_requests/14080
[2] https://gitlab.com/fdroid/fdroiddata/-/merge_requests/14080/diffs?commit_id=bfc062a358dc574326a29f08e01c0e80cadd80cb

Change-Id: Ibede06d13095d8e83dcc88ee09a8a610d6a9de0f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160150
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-11-30 14:40:24 +01:00
3ee963afc7 android: Simplify vendor info handling for about dialog
Similar to

    Change-Id: Iaa78f5a6020bea4ed80a1b41d3b23cc8d313813c
    Author: Michael Weghorn <m.weghorn@posteo.de>
    Date:   Thu Nov 30 12:00:52 2023 +0100

    android: Simplify version info handling for about dialog

, also simplify the handling of the vendor info text by
retrieving the text from the string resource right away.

Change-Id: I7d56b1814454be2bc8d13e01265f0a0db6d865be
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160147
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-11-30 14:40:08 +01:00
4958e21332 android: Simplify version info handling for about dialog
* Don't set and retrieve the placeholder text in/from
  the TexView in the about dialog, but use the string
  resource directly.
* Add the HTML code directly in the string resource,
  rather than having to fiddle with that in the Java
  code.

With this in place, only the version name and the
commit hash need to be replaced.

Since there is no placeholder text in the text view,
it's also no longer necessary to explicitly set an
empty string in case of an exception.

Change-Id: Iaa78f5a6020bea4ed80a1b41d3b23cc8d313813c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160146
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-11-30 14:39:59 +01:00
322f8e8cb7 tdf#124480 android: Use an actual button for "Select file to open"
Instead of using a TextView and setting `?attr/colorButtonNormal`
for the background color, just use a button right away, which also
makes sure that the proper button color is used and avoids
using `colorButtonNormal` only available from API level 21 on. [1]

Also drop the extra `LinearLayout` parent that was only containing
this one TextView.

While at it, drop an unused import.

[1] https://developer.android.com/reference/android/R.attr#colorButtonNormal

Change-Id: Ie2f7e2646d20f4051fb2513fb8fd72572ce19217
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160076
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-11-30 12:17:07 +01:00
d134615570 tdf#158398 android: Draw light gray background for Calc headers
Similar to the desktop version, use a light gray background
color for the Calc header cells.

There was already code in place to draw darker gray background
to highlight the header cell when a cell in that row/column is
selected.
(The actually highlighted header cell didn't wasn't always the
correct one in a quick test, but that's independent of this change.)

Adapt that to always fill the rectangle, but use a lighter gray
(lower alpha value) when not selected.
Use a separate `Paint` object for the frame (stroke).
Set the frame color and text color to black instead of gray, for
better contrast to the light gray fill/background.

Change-Id: I0490811e928ebd1b3840242fc1aa4682b2786b00
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159989
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-11-27 14:04:21 +01:00
7c7e044f3c tdf#158398 android: Center Calc header text
Center the header text in the Calc header cell, to
make better use of the space. This is in line with
what the desktop version also does.

Setting the text alignment to `Paint.Align.CENTER`
is sufficient for centering horizontally.
There's no equivalent for centering vertically, so
calculate the position based on the text bounds.

Change-Id: Ia8d5d8434b703cb7daecd34ae70405883f22f0d5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159988
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-11-27 14:04:13 +01:00
808a94d859 android: Make CalcHeaderCell fields final
Change-Id: I7e14145569428a2803f9376cf719e524aa8963a8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159987
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-11-27 14:04:04 +01:00
872d26d4a8 android: Suggest file name for PDF export
When using the PDF export feature in Android Viewer,
suggest a file name for the PDF file that matches
the current display name (which is usually the
file name, or "untitled" for a newly created doc
that hasn't been saved yet).

This can be achieved by setting `Intent.EXTRA_TITLE`
for the `ACTION_CREATE_DOCUMENT`. [1]

The `DocumentsContract.EXTRA_INITIAL_URI` already
set previously already results in the same
directory as the doc being preselected in the
file chooser:

> Callers can set a document URI through
> DocumentsContract#EXTRA_INITIAL_URI to indicate the initial location of
> documents navigator. System will do its best to launch the navigator in
> the specified document if it's a folder, or the folder that contains the
> specified document if not.

Filling in the current file name was suggested
in a Google Play review comment for the app.

[1] https://developer.android.com/reference/android/content/Intent#ACTION_CREATE_DOCUMENT

Change-Id: Idbd4a89416089f927e0232ce65161b43059ca46d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159959
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-11-26 18:07:37 +01:00
934a4937e3 tdf#158331 android: Fix "Save As" for non-experimental mode
While "Save" (i.e. saving back to the original location)
doesn't make sense when editing is disabled (because the
doc cannot be changed) and the menu entry is therefore
not available when the experimental editing mode is
disabled, "Save As" does make sense, e.g. in order to
save a copy of a file opened from another app.

The menu entry was there, but not working as expected,
a 0-byte file was created.

This is because `LibreOfficeMainActivity#saveFileToOriginalSource`
would return early if experimental mode is disabled.
No longer do that, but save the file as requested.

Change-Id: I5785b6060c4ba9cdf3e9c3591b9f941ab987bf4f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159857
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-11-23 13:20:56 +01:00
129c493adc android: Reuse launcher icon in activities
Instead of duplicating the icon as drawable,
just use the one from the mipmap folder that's
used for the app launcher.

Change-Id: Idd6691c4639fb570357280cec63636d07fe06b20
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159553
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-11-17 12:35:38 +01:00
f9b9e70246 android: Add button to open privacy URL
In the About dialog, add a "Privacy Policy"
button when a privacy URL is set, i.e.
the `--with-privacy-policy-url=<URL>` autogen
option is used.
Clicking the button will fire an Intent
to open that URL.

Use a custom build config field as described at [1]
to make the privacy policy URL available to
the Java code.

[1] https://developer.android.com/build/gradle-tips#share-custom-fields-and-resource-values-with-your-app-code

Change-Id: I6e1a9aff885e4ce132284f49e722b3343fc51b79
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159445
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-11-15 18:26:41 +01:00
1d7b1e2d40 android: Drop "More Info" item in "About" dialog
Drop the "More Info" button from the dialog, which
opened a sample document with more information
about LibreOffice.

There's already a link to the website, and the
"neutral" button in that dialog will be reintroduced
to show the privacy policy instead, if set.
(An `AlertDialog` has at most 3 buttons.)

Change-Id: Ib760daba1ed6f8cfc26eefc7412553bf97c77d70
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159444
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-11-15 18:26:33 +01:00
c5c2d31951 android: Drop unused LayerView#mFullScreen
... and the getters and setters.

Change-Id: I14e69e2543d92dc63954bc3faf5a7456d2343fff
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159200
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-11-09 14:40:43 +01:00
f324220e87 android: Drop Robocop comment
Robocop is a tool for UI-testing fore Firefox on Android [1],
but not used for LibreOffice Viewer, so drop the misleading
comment.

[1] https://wiki.mozilla.org/Auto-tools/Projects/Robocop

Change-Id: I270735b2258f18691f60865c683856d58a94bb04
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159199
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-11-09 13:18:17 +01:00
aef1b023d5 android: Drop never-assigned to LayerRenderer#mPixelBuffer
That member was never assigned a value but only read
from by code claiming to be "used by robocop for testing purposes".

[1] describes Robocop as a UI-level testing framework for Firefox
for Android, which we don't use, so drop the class member and
related test code.

[1] https://wiki.mozilla.org/Auto-tools/Projects/Robocop

Change-Id: I467296874d4295060cc9670d1f1c8b0dfeb77523
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159198
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-11-09 13:18:11 +01:00
d9a43fa5f9 tdf#158125 android: Don't insist on RGB 565 EGL config
As the `eglChooseConfig` doc [1] says:

> eglChooseConfig returns in configs a list of all EGL frame buffer
> configurations that match the attributes specified
> [...]
> Attributes are matched in an attribute-specific manner. Some of the
> attributes, such as EGL_LEVEL, must match the specified value exactly.
> Others, such as, EGL_RED_SIZE must meet or exceed the specified minimum
> values.

The config/attribute list used for Android Viewer specifies
EGL_RED_SIZE=5, EGL_GREEN_SIZE=6, and EGL_BLUE_SIZE=5 and so
far, only configs using exactly those bit sizes were accepted,
causing 1 of the 11 devices used in automated tests in Google Play CI
crashing with this stack trace:

    Exception org.mozilla.gecko.gfx.GLController$GLControllerException: No suitable EGL configuration found
      at org.mozilla.gecko.gfx.GLController.chooseConfig (GLController.java:219)
      at org.mozilla.gecko.gfx.GLController.initEGL (GLController.java:172)
      at org.mozilla.gecko.gfx.GLController.initEGLContext (GLController.java:176)
      at org.mozilla.gecko.gfx.GLController.initGLContext (GLController.java:57)
      at org.mozilla.gecko.gfx.RenderControllerThread.doSurfaceCreated (RenderControllerThread.java:132)
      at org.mozilla.gecko.gfx.RenderControllerThread.execute (RenderControllerThread.java:52)
      at org.mozilla.gecko.gfx.RenderControllerThread.run (RenderControllerThread.java:30)

Since only configs fulfilling the minimium specification
have been returned, I don't see a reason to insist on
having one that uses exactly the specified amount of bits
for the individual color components.

I also didn't see any rendering issues in a quick test (also using
the colorful Calc sheet attachment 188343 from tdf#156182) forcing the
use of a configuration using EGL_RED_SIZE=8, EGL_GREEN_SIZE=8, and
EGL_BLUE_SIZE=8 with an x86_64 AVD and on a Fairphone 3+ (arm64)
using this temporary local change:

    diff --git a/android/source/src/java/org/mozilla/gecko/gfx/GLController.java b/android/source/src/java/org/mozilla/gecko/gfx/GLController.java
    index 45600e9f1e7c..9e7f348e9e72 100644
    --- a/android/source/src/java/org/mozilla/gecko/gfx/GLController.java
    +++ b/android/source/src/java/org/mozilla/gecko/gfx/GLController.java
    @@ -171,7 +171,7 @@ public class GLController {
                 mEGL.eglGetConfigAttrib(mEGLDisplay, config, EGL10.EGL_RED_SIZE, red);
                 mEGL.eglGetConfigAttrib(mEGLDisplay, config, EGL10.EGL_GREEN_SIZE, green);
                 mEGL.eglGetConfigAttrib(mEGLDisplay, config, EGL10.EGL_BLUE_SIZE, blue);
    -            if (red[0] == 5 && green[0] == 6 && blue[0] == 5) {
    +            if (red[0] == 8 && green[0] == 8 && blue[0] == 8) {
                     return config;
                 }
             }

Therefore, fall back to using another config that fulfils the
specification.
(Leave the previously required config as preferred one for now,
maybe it still has advantages, e.g. might be more efficient due
to not wasting extra bits for the color components that are
not needed for the rendering in LibreOffice Viewer. (?))

[1] https://registry.khronos.org/EGL/sdk/docs/man/html/eglChooseConfig.xhtml

Change-Id: I953d292248004bc6f7e9384ceef78c8a88c21e9e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159204
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-11-09 13:16:16 +01:00
560cb9c53e android: Drop obsolete TODO comment
This comment was originally for the code
underneath, that has already been separated
into a separate method in gecko-dev commit [1]

    commit 60ed20fee4095523ee498579c71fc17032d1004b
    Author: Patrick Walton <pwalton@mozilla.com>
    Date:   Mon Feb 13 12:27:09 2012 -0800

        Split out Java compositor shader program activation and deactivation into separate functions

, but the comment was left behind.

[1] 60ed20fee4

Change-Id: Ied0a4aaec4d8228665748b834026b54c8e9615bc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159184
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-11-09 07:56:07 +01:00
f435857825 android: Drop unused GLController#checkForLostContext
Change-Id: Ia9f313a1937d4d491b76e9e5d6e4689eeb20431b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159183
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-11-09 07:55:53 +01:00
46c0c48990 android: Cast to GL10 in getter, not callers
Better have a clear method signature than callers
relying on implementation details.

Change-Id: I4532f67aee8f8eac723401e43d3b6856ba37b346
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159182
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-11-09 07:55:44 +01:00
b6e5a8d60b android: Use local var instead of 'mGL' member
It's never used except where it's also previously
assigned, so use a local variable instead.

Even the getter `GLController#getGL` gets
it from the EGLContext instead of using the
member.

Change-Id: Icec909f6e3e508a16fb455e81474bb336dc09362
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159181
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-11-09 07:55:32 +01:00
e4a56c1996 android: Use local var instead of class member
It's only used in this one place.

Change-Id: Ia11ebc2ea60c4015698ac00bbec6711a20c0a22e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159168
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-11-09 07:55:18 +01:00
3cedd0780e android: Drop unused LayerRenderer#Frame#getMaskForLayer
Unused since

    commit 96a498b44c0a0ca48ac9938d9414191850d47d18
    Date:   Fri Dec 19 16:24:02 2014 +0900

        android: remove screenshot layer

Change-Id: I3b83596bb854cb4bdfc6281ca487c8be15bc61d0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159167
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-11-09 07:55:09 +01:00
61bfc27f04 android: Drop LayerRenderer#Frame#mFrameStartTime
The member is assigned a value that is never used, so just drop it.

Might have been more useful before

    commit 8734422b0b85b54c3fccc2b678171ed174c2b8bd
    Date:   Mon Feb 23 20:53:35 2015 +0900

        android: remove DrawTimingQueue and PanningPerfAPI

Change-Id: Ieec958c0d5a75fc47af467c73b218d6150ceaab4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159166
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-11-09 07:55:01 +01:00
120e76b45b android: Inline LayerRenderer#createFrame
No need for an extra method just to call the ctor,
and which is only used once.

Change-Id: Ide909ad81c78dc822a721771ee068e0240750089
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159165
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-11-09 07:54:53 +01:00
8b3f0a66b4 android: Add "@Override"
... to make clear that these are overriden methods from
the `GLSurfaceView.Renderer` interface.

Change-Id: I7ffc47ee8a7ca4b481f7d28c0a5084c89d9c7ae8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159164
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-11-09 07:54:44 +01:00
ae61af8364 android: Drop misleading comments wrt methods invoked via JNI
These methods are not invoked via JNI for LibreOffice Viewer.
It might have been true for Fennec/Gecko, but isn't here, so
drop the misleading comments.

Change-Id: Ib3187b129f076f42706b3097f9535a7cca7ad55f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159163
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-11-09 07:54:34 +01:00
30a981cc20 android: Drop unused LayerView#registerCxxCompositor
The comment saying it's called via JNI is not true
for LibreOffice Viewer, is probably from Gecko/Fennec
days like the ones for previously dropped methods.

Now that the method is gone, `mContext` no longer
needs to be static, so make it non-static and drop
the corresponding TODO comment.

Change-Id: I32db3728234715bc29af1ad757c715003c70ca4b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159162
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-11-09 07:54:24 +01:00
d088e3cfc5 android: Drop unused LayerView#{g,s}etPaintState
... and the now also unused `mPaintState` member and
related constants.

Change-Id: Iefd40ca4a72d32807b136830833e88e250f8f38b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159161
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-11-09 07:54:16 +01:00
0a5bf928d9 android: Drop unused GLController#waitForValidSurface
The method is unused, so drop it, and also the now never
read `mSurfaceValid` member.

Likely, the comment that the method is invoked via JNI
was never valid for LibreOffice Viewer, but is from Gecko/Fennec
days, similar to the case in the previous commit,

    Change-Id I54dd33a2ce30ebdc375a7c1fefacca6e99d2f571
    Author: Michael Weghorn <m.weghorn@posteo.de>
    Date:   Wed Nov 8 15:10:19 2023 +0100

        android: Drop unused GLController#resumeCompositorIfValid etc.

Change-Id: I165d2c7ebf5b9ce940b608d738d9a10d5bef69ea
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159160
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-11-09 07:54:08 +01:00
3242398926 android: Drop unused GLController#resumeCompositorIfValid etc.
The comment claiming that this function is invoked
by JNI was true when the method was added upstream
in Fennec/Gecko in commit [1]

    commit ae9420729da323d02a3f2f02d5a4b3043a619007
    Author: Kartikaya Gupta <kgupta@mozilla.com>
    Date:   Fri Jul 13 10:19:46 2012 -0400

        Bug 769269 - Update the graphics code to be able to deal with blowing away the layer controller, client, and view and creating them afresh. r=ajuma

, but it's not true for the copy here in
Android Viewer, so drop the unused method
and `RenderControllerThread#compositionResumeRequested`
that would only have been called from there and wouldn't
have done anything anyway.

[1] ae9420729d

Change-Id: I54dd33a2ce30ebdc375a7c1fefacca6e99d2f571
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159159
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-11-09 07:54:01 +01:00
9032551306 android: Drop unused GLController#provideEGLSurface
It was already unused when added in

    commit a6ecd8b2a9f0f3eaa66388861a6dcc6260ec72b9
    Date:   Thu Jun 26 11:22:21 2014 +0200

        LOAndroid3: ant/make for building, Bootstrap project

The method looks similar to the first half of
`GLController#provideEGLSurface` and is unused,
so drop  it.

Change-Id: I0cabfddefcdcca97048cb6f494590afdde5c1dc7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159158
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-11-09 07:53:52 +01:00
9844a197bf tdf#147906 used StrictMath.hypot for Pythagorean addition
Change-Id: I529dc199c2cc20ce91b7181f650c36db8d81fc9c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157098
Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
Tested-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
2023-09-21 07:15:22 +02:00
60e804f31c android: Drop unused TextureView
It's unused since

    commit 3860bff1013f9608b934c4cdb9ddb8d2dbbc3e52
    Date:   Fri Dec 19 16:25:23 2014 +0900

        android: never use TextureView for now (for performance reasons)

        Get align with latest Fennec code which also has this disabled.

        Change-Id: Ie4c27935bacd29218207e47593f073bdce0cf7e3

Change-Id: I808ce73928120c10f4e3721a11b1e74bac3a413c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147196
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-02-17 12:06:41 +00:00
b60fc720d7 android: Drop unused LayerView#isIMEEEnabled
... that always returns false anyway.

(And the `InputConnectionHandler#isIMEEnabled`
that would be called in the commented out code
doesn't exist either.)

Change-Id: I6031672ee2835c64a1efcab946574ca2ce94b6a1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147195
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-02-17 12:06:31 +00:00
08cfcea7fe tdf#147906 Use Math.hypot() for Pythagorean addition
Change-Id: I644947ca22f493bbc805c45334450db8d4b4808b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146137
Tested-by: Hossein <hossein@libreoffice.org>
Reviewed-by: Hossein <hossein@libreoffice.org>
2023-02-06 18:37:58 +00:00
f5e4a54f8c android: Hide UI to creat new files for SDK version < 19
Just like for the the case where editing is disabled
(s. Change-Id I2f8c86f5db96a5135ff8a66a7a7078b664d05a5e,
"android: Only offer creating docs when editing enabled"),
just hide the UI to create new files when running on devices
that don't support `Intent.ACTION_CREATE_DOCUMENT`, rather
than showing the button, but then showing a message that
creating files is not supported once the button is clicked.

Change-Id: Ifedf40e22dc8906557d5364ecf9ec3a9db2315e6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145736
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-01-18 13:03:54 +00:00
5e4bcb501f android: Only offer creating docs when editing enabled
Hide the UI to create new documents unless the
experimental editing mode is enabled. There is
little use in creating new empty documents when there
is no way to edit them...

Change-Id: I2f8c86f5db96a5135ff8a66a7a7078b664d05a5e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145735
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-01-18 13:03:46 +00:00
377a8c8ed7 tdf#153058 android: Use "fit page" for min zoom level
So far, Android Viewer was using "fit page width"
as minimum zoom level, meaning that it was impossible
to zoom out to see the full page, e.g. when opening
a doc with page size A4 portrait and using
the device in landscape mode.

Change the minimum zoom level to take the page
height into account as well, i.e. adapt the minimum
zoom level to be "fit whole page" to allow doing that.

However, keep applying "fit page width" as
zoom level when double-tapping, by using
the "fit page width" zoom level as new
default zoom level and applying the default
instead of the minimum zoom level on
double-tap.
("Fit page width" is probably more desirable
than "fit whole page" at least when used on small
devices, at least in all cases where
writing is in horizontal direction, so the user
can see the current portion of text and scroll
down to continue reading/writing.)

Use on double-tap is currently the only use for the
default zoom level, the only previous occurence
was effectively unused since

        commit 9ab43aebad67383057d2cc3f754ce2193fa78b4e
        Date:   Wed Dec 4 17:18:20 2019 +0100

            android: Allow zooming for Calc as well

and finally dropped with
Change-Id I702874f1d9161e5cef660bb4c4a0b7864d6e3c09
("android: Drop superfluous ZoomConstraints#mAllow{,DoubleTap}Zoom").

Change-Id: Ica5d8207bc19a81173143fcb5c3747dc89f9fa81
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145658
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-01-17 11:08:27 +00:00
7c39976705 android: Drop superfluous ZoomConstraints#mAllow{,DoubleTap}Zoom
Both members are always set to true since

    commit 9ab43aebad67383057d2cc3f754ce2193fa78b4e
    Date:   Wed Dec 4 17:18:20 2019 +0100

        android: Allow zooming for Calc as well

, so drop the two now superfluous members and
getters.

Change-Id: I702874f1d9161e5cef660bb4c4a0b7864d6e3c09
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145657
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-01-17 11:08:21 +00:00
d993327eab android: Offer "Save" entry independent of edit actions
Move the "Save" menu entry out of "group_edit_actions",
which gets hidden when switching from edit to view
mode when the experimental editing feature is enabled
in Android Viewer.

This e.g. makes sure that the "Save" entry is offered
for the following scenario (just as the "Save as" entry
is as well):

* ensure experimental editing feature is enabled
* open existing doc
* edit the document
* switch back to view mode by tapping the left-most
  item in the editing toolbar

Since the doc was modified, the "Save" entry should
be present then.

Explicitly hide the entry when the experimental
editing feature is disabled, since that no longer
happens through "group_edit_actions" now.

Change-Id: Ibe7736932021d7516e2fd3a09ae9276015fe0d56
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144872
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-12-30 11:17:40 +00:00
037680488b android: Enable multidex, update com.google.android.material to 1.7.0
Release notes:
https://github.com/material-components/material-components-android/releases/tag/1.7.0

With the material update in place, multidex needs to be enabled since the
app has minSdkVersion 16 (i.e. smaller than 21) and now references
more then 65,536 methods, see [1] for more background.

Therefore, carry out the changes to support multidex
as mentioned in [2].

Without enabling multidex, the build would fail like this:

    > Task :mergeExtDexStrippedUIDebug FAILED
    ERROR:D8: Cannot fit requested classes in a single dex file (# methods: 68864 > 65536)
    com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
    The number of method references in a .dex file cannot exceed 64K.
    Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html
            at com.android.builder.dexing.D8DexArchiveMerger.getExceptionToRethrow(D8DexArchiveMerger.java:151)
            at com.android.builder.dexing.D8DexArchiveMerger.mergeDexArchives(D8DexArchiveMerger.java:138)
            at com.android.build.gradle.internal.tasks.DexMergingWorkAction.merge(DexMergingTask.kt:859)
            at com.android.build.gradle.internal.tasks.DexMergingWorkAction.run(DexMergingTask.kt:805)
            at com.android.build.gradle.internal.profile.ProfileAwareWorkAction.execute(ProfileAwareWorkAction.kt:74)
            at org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:63)
            at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1.create(NoIsolationWorkerFactory.java:66)
            at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1.create(NoIsolationWorkerFactory.java:62)
            at org.gradle.internal.classloader.ClassLoaderUtils.executeInClassloader(ClassLoaderUtils.java:97)
            at org.gradle.workers.internal.NoIsolationWorkerFactory$1.lambda$execute$0(NoIsolationWorkerFactory.java:62)
            at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:44)
            at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:41)
            at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204)
            at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:199)
            at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
            at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
            at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
            at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
            at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53)
            at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:73)
            at org.gradle.workers.internal.AbstractWorker.executeWrappedInBuildOperation(AbstractWorker.java:41)
            at org.gradle.workers.internal.NoIsolationWorkerFactory$1.execute(NoIsolationWorkerFactory.java:59)
            at org.gradle.workers.internal.DefaultWorkerExecutor.lambda$submitWork$2(DefaultWorkerExecutor.java:205)
            at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
            at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runExecution(DefaultConditionalExecutionQueue.java:187)
            at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.access$700(DefaultConditionalExecutionQueue.java:120)
            at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner$1.run(DefaultConditionalExecutionQueue.java:162)
            at org.gradle.internal.Factories$1.create(Factories.java:31)
            at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:270)
            at org.gradle.internal.work.DefaultWorkerLeaseService.runAsWorkerThread(DefaultWorkerLeaseService.java:119)
            at org.gradle.internal.work.DefaultWorkerLeaseService.runAsWorkerThread(DefaultWorkerLeaseService.java:124)
            at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runBatch(DefaultConditionalExecutionQueue.java:157)
            at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.run(DefaultConditionalExecutionQueue.java:126)
            at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
            at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)

[1] https://developer.android.com/studio/build/multidex
[2] https://developer.android.com/studio/build/multidex#mdex-gradle

Change-Id: Ie5d78a54e7f69b55586d80718c04e71526ebad6f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144838
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-12-28 08:28:48 +00:00
cfc73f3373 android: Add buttons to increase/decrease indent
This adds two buttons to the formatting toolbar to
increase/decrease the indent, using the corresponding
UNO commands. These can be used when the experimental
editing mode for Android Viewer is enabled.

The drawable resources were created using the
corresponding sifr_svg icons (incrementindent.svg,
decrementindent.svg).

Change-Id: Id8f0fc9a5ea686b474ec9a4b4dcdf23407e9ac98
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144789
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-12-23 23:24:03 +00:00
70d9e7eadb tdf#85592 android: .uno:BackColor deprecated, use .uno:CharBackColor
Follow-up. I didn't want to include it in the main deprecation patch.
No good reason - android is just too different and untestable by me.

Change-Id: I661211aea619af256e38dc685fdd0662e5aa7272
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140284
Reviewed-by: Justin Luth <jluth@mail.com>
Tested-by: Jenkins
2022-12-20 00:15:43 +00:00
e5fb120a32 Fix typo in code
Change-Id: I6fae9a4df450f80ee2af59e271a8cb1dd8bc918f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134047
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
2022-05-09 23:45:49 +02:00
1bb9036e90 android: Don't use res Id in switch-case (ToolbarController)
Like Change-Id I9d563b6ad4ed70a891c583a82331dd80db5956dc,
"android: Avoid using res ID in switch-case (FormattingController)",
but for `TollbarController`.

Change-Id: I40f23b6a91ddf0bb7e90c3b3b690fe332cd874ea
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133999
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-05-08 08:29:20 +02:00
dcc6b286ea android: Don't use res ID in switch-case (SearchController)
Addresses this Lint warning:

> ../../src/java/org/libreoffice/SearchController.java:73: Resource IDs
> will be non-final by default in Android Gradle Plugin version 8.0, avoid
> using them in switch case statements

There's no need to explicitly set `SearchDirection.DOWN`
for `R.id.button_search_down` since it has previously been
set as default value anyway.

Change-Id: I283c00b97e1417f5dc3a48922238df7a29032137
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133998
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-05-08 08:28:38 +02:00
1c5a8b5eaf android: Avoid using res ID in switch-case (FormattingController)
Adresses Lint warnings like this in FormattingController:

> ../../src/java/org/libreoffice/FormattingController.java:89: Resource
> IDs will be non-final by default in Android Gradle Plugin version 8.0,
> avoid using them in switch case statements
>
>   86
>   87      switch(button.getId()) {
>   88
>   89          case R.id.button_insertFormatListBullets:
>   90              LOKitShell.sendEvent(new LOEvent(LOEvent.UNO_COMMAND, ".uno:DefaultBullet"));
>   91              break;

Change-Id: I9d563b6ad4ed70a891c583a82331dd80db5956dc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133997
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-05-08 08:27:52 +02:00
e1381521c5 android: Allow setting auto font/bg color
Add a button in the color palette UI
(that can be found in the bottom toolbar
under "Styles" -> "Font Color"/"Highlight Color"
when experimental editing mode is enabled) which
allows setting auto color for the font
or the highlighting/background.
This allows to unset any explicitly set color and
use the automatic color.

This is equivalent to the "Automatic"/"No fill color"
items in the font color and character highlighting
color popups in the desktop version.

Add a `boolean keepAlpha` param to
`sendFont{,Back}ColorChange` to be able
to distinguish between "auto color" and white
when -1/0xFFFFFFFF is passed as color.
See also previous commit
Change-Id I2e6512f32e671f92c8d31b2780c350dd74fb0747,
"android: Handle auto color as such", for some more
context.

Change-Id: I05182a2adbc00e64b1925ff52861a51ba8dcc21f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133996
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-05-08 08:27:05 +02:00