summaryrefslogtreecommitdiff
path: root/android
AgeCommit message (Collapse)Author
2023-03-13android: Update Android Gradle Plugin to 7.4.2Michael Weghorn
Change-Id: Idee4fddd7fd2b610fef194b86ace88469c3124da Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148749 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-02-28add ipv6 enabled maven repositoryChristian Lohmaier
maven central so far doesn't support ipv6 on the primary URL (see https://issues.sonatype.org/browse/MVNCENTRAL-658 ), it is only enabled on a dedicated ipv6.repo1.maven.org URL currently. Add that one to the list of repositories so that ipv6-only hosts can also fetch the dependencies. (when using internal ipv4 as well, you'll also need to export JAVA_OPTS="-Djava.net.preferIPv6Addresses=true" since otherwise the gradle wrapper fails to download gradle) Change-Id: I22f0e07fd4e6bb518396f76db20c174e45588372 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147917 Tested-by: Jenkins Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
2023-02-17android: Update com.google.android.material to 1.8.0Michael Weghorn
Change-Id: I2e2049c5d832aa9ea82feaabf3a86fd8c87a9668 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147197 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-02-17android: Drop unused TextureViewMichael Weghorn
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-17android: Drop unused LayerView#isIMEEEnabledMichael Weghorn
... 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-16android: Use libc++_shared path that works for NDK 25, tooMichael Weghorn
While e.g. NDK 23.0.7599858 has both, `$HOME/Android/Sdk/ndk/23.0.7599858/sources/cxx-stl/llvm-libc++/libs/x86/libc++_shared.so` and `$HOME/Android/Sdk/ndk/23.0.7599858/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/i686-linux-android/libc++_shared.so` (with the same content), NDK 25.1.8937393 no longer ships that under the former path scheme, just the latter. Therefore, use that one when copying the library, in preparation to add support for NDK 24 and 25. Change-Id: I20894701f4f436f41781467b57ec4f5311a8317f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146133 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-02-16android: Use actual Android API level for minSdkVersion, nssMichael Weghorn
When an Android API level is explicitly set with the `--with-android-api-level` switch introduced in commit 4c0bccbb21ba022fd9d630eb1d9ae34673b4dc11 Date: Thu Jul 4 09:06:49 2019 +0200 android: Allow specification of the API level. , use that for the minSdkVersion for the Android Viewer app and the API level for the NSS build, rather than leaving that hard-coded at API level 16. Building with a newer API level means that the app won't run on devices with older API levels. With this in place, this will be recognized at install time (installation will fail: INSTALL_FAILED_OLDER_SDK) rather than crashing at run time. Change-Id: Id6047b768d265b965696f3a3161d7828e5f3696e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146127 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-02-16android: Require NDK 23 and use default linker lldMichael Weghorn
Using lld instead of hard-coding ld.gold speeds up linking liblo-native-code.so from about 40 seconds to about 10 seconds for my x86 debug Android build with NDK 23.2.8568313. lld was added in NDK 21, made default in NDK 22 [1]. lld doesn't know the `--no-keep-files-mapped` option, so drop that as well. ld.gold had previously been hard-coded in commit c6dadf5035c8e1c31dbd3fccec167bd4a906bf54 Date: Fri Nov 1 17:57:17 2019 +0100 android: Fix linking of liblo-native-code.so on aarch64. , but lld wasn't available yet back then. To make sure that lld is used by default, NDK >= 22 has to be used. In addition, due to a clang bug in NDK 22.1.7171670 [2] ("Misspelled -fnostack-clash-protection"), building for aarch64 Android with that NDK version would fail as follows: clang++: error: unknown argument '-fno-stack-clash-protection'; did you mean '-fnostack-clash-protection'? clang++ version: $ /home/michael.weghorn/Android/Sdk/ndk/22.1.7171670//toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --version Android (7155654, based on r399163b1) clang version 11.0.5 (https://android.googlesource.com/toolchain/llvm-project 87f1315dfbea7c137aa2e6d362dbb457e388158d) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /home/michael.weghorn/Android/Sdk/ndk/22.1.7171670//toolchains/llvm/prebuilt/linux-x86_64/bin Rather than work around that bug on LO side, require NDK 23.x right away, since that provides a clang where this is fixed. Both, non-debug as well as `--enable-dbgutil` builds with NDK version 23.2.8568313 were successfully tested for all 4 supported architectures and these devices: * aarch64: Fairphone 3 Plus, LineageOS 19 (Android 12), API 31 * arm32: Samsung Galaxy S4 I9505, LineageOS 17.1 (Android 10), API 29 * x86: * AVD: Nexus 4, API 16 * AVD: Pixel 2, API 30 * x86_64: AVD: Pixel 2, API 33 [1] https://developer.android.com/ndk/downloads/revision_history [2] https://bugs.llvm.org/show_bug.cgi?id=47139 Change-Id: I9ea714255faf29d50bb5f8e206f13495637da867 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146119 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-02-09android: Update Android Gradle Plugin to 7.4.1Michael Weghorn
Change-Id: I2a709e27d3ba42f0d1c2ae9510d2cbf1f38c484d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146682 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-02-06tdf#147906 Use Math.hypot() for Pythagorean additionYomnasalama
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-01-18android: Hide UI to creat new files for SDK version < 19Michael Weghorn
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-18android: Only offer creating docs when editing enabledMichael Weghorn
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-18android: Update Android Gradle Plugin to 7.4.0Michael Weghorn
... and gradle to 7.5. Change-Id: If5156ab18dc500dafdfa4f8a0f6e6c2563acc4db Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145711 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-01-17tdf#153058 android: Use "fit page" for min zoom levelMichael Weghorn
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-17android: Drop superfluous ZoomConstraints#mAllow{,DoubleTap}ZoomMichael Weghorn
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-17tdf#153009 android: Include more doc layout related XML filesMichael Weghorn
instdir/share/config/soffice.cfg/simpress/objectlist.xml contains default positions for elements that are used in new Impress presentations, but that file wasn't included in the Android app/APK previously, so couldn't be read from in `SdDrawDocument::InitObjectVector`. As a result, the title and text were misplaced when creating a new presentation in Android Viewer. Include all of the related Impress XML files into the app to make this work as expected. (At least a failed attempt to read from `layoutlist.xml` was also observed while debugging the issue mentioned above.) Change-Id: Iba1ac68c0b983d3e465515f07b3fc67162a0ee3f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145621 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-01-17tdf#153009 android: Set BRAND_SHARE_SUBDIR for more default structureMichael Weghorn
Set `BRAND_SHARE_SUBDIR=share` in the `fundamentalrc` shipped with Android Viewer, as is the case for the desktop variant as well. This implies that the .ui files will be expected underneath the "config/share" directory in the app's assets from now on instead of just "config", since `BRAND_SHARE_SUBDIR` will be expanded accordingly in the paths. Therefore, put the .ui files there. Merge the block responsible for copying UI files into into the existing block already copying to that dir in the `copyTask` gradle task. There seems to be no particular reason for omitting the "share" subdirectory just for the .ui files in the Android assets. This is also in preparation of fixing tdf#153009: Not having `BRAND_SHARE_SUBDIR` set on Android resulted in "vnd.sun.star.expand:$BRAND_BASE_DIR/$BRAND_SHARE_SUBDIR/config/soffice.cfg/simpress/objectlist.xml" previously getting expanded to file:///assets//config/soffice.cfg/simpress/objectlist.xml in `SdDrawDocument::InitObjectVector`, and that would cause failure to read object property settings (e.g. for the placeholder text in a new Impress presentation) from that file, even when `objectlist.xml` was put into the app's assets (s. Change-Id Iba1ac68c0b983d3e465515f07b3fc67162a0ee3f, "tdf#153009 android: Include more doc layout related XML files") at "config/soffice.cfg/simpress/objectlist.xml" due to the double-slash after "assets" not being treated the same way as a single slash at that place. Change-Id: Ia9d86e1f59daf8a41951cefb3a1e9f82f0e9f184 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145619 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-01-06android: Enable checksum verification for gradle downloadMichael Weghorn
Follow the F-Droid Bot suggestion in [1] and set the checksum from [2] in gradle-wrapper.properties, so a downloaded gradle distribution will be verified against that, s. doc at [3]. Command used from within the `android/source` directory: ./gradlew wrapper --distribution-type all --gradle-distribution-sha256-sum cd5c2958a107ee7f0722004a12d0f8559b4564c34daad7df06cffd4d12a426d0 Note that this is the checksum for the gradle distribution, not the gradle wrapper (which is mentioned in Change-Id I3f466061aba55c5704fe251eee7e8c73f7d316aa instead.) Also note that Android Studio does not fully support the "distributionSha256Sum" attribute and requires confirming in a message saying so that the checksum is correct before syncing the project, s. [4]. [1] https://gitlab.com/fdroid/fdroiddata/-/merge_requests/12380#note_1229239229 [2] https://downloads.gradle-dn.com/distributions/gradle-7.4-all.zip.sha256 [3] https://docs.gradle.org/current/userguide/gradle_wrapper.html#configuring_checksum_verification [4] https://issuetracker.google.com/issues/129261435#comment11 Change-Id: I39902be79e7dad2ad006262efe3b6c6ab3b5de5a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145105 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-01-06android: Update gradle wrapper to 7.4Michael Weghorn
Commit the result of running ./gradlew wrapper --distribution-type all --gradle-version 7.4 from within the `android/source` directory as described at [1]. Double-check that the sha256sum of the jar file matches what is listed on the website [2] for v7.4: $ sha256sum gradle/wrapper/gradle-wrapper.jar 575098db54a998ff1c6770b352c3b16766c09848bee7555dab09afc34e8cf590 gradle/wrapper/gradle-wrapper.jar (Interestingly, the sha256sum of the gradle-wrapper.jar used so far, e2b82129ab64751fd40437007bd2f7f2afb3c6e41a9198e628650b22d5824a14, is not the one of any listed versions there, which is what the F-Droid bot marked as error in a MR to update LibreOffice Viewer [3]). [1] https://docs.gradle.org/current/userguide/gradle_wrapper.html#sec:upgrading_wrapper [2] https://gradle.org/release-checksums/ [3] https://gitlab.com/fdroid/fdroiddata/-/merge_requests/12380#note_1229239229 Change-Id: I3f466061aba55c5704fe251eee7e8c73f7d316aa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145098 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-12-30android: Offer "Save" entry independent of edit actionsMichael Weghorn
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-28android: Use PNG icons instead of vector image for compatibilityMichael Weghorn
Convert the drawable resources added in commit cfc73f3373f49770b859bc68cbf6bd987342f9ad Date: Fri Dec 23 23:20:26 2022 +0100 android: Add buttons to increase/decrease indent to use PNG images (PNG export of the SVG images used previously, using Inkscape) instead of vector drawables, since devices with old API versions apparently don't support these vector drawables. Trying to open any doc in an x86 AVD with API version 16 would result in LO crashing with this exception in ADB log: E/AndroidRuntime( 2948): java.lang.RuntimeException: Unable to start activity ComponentInfo{org.libreoffice/org.libreoffice.LibreOfficeMainActivity}: android.view.InflateException: Binary XML file line #281: Error inflating class ImageButton E/AndroidRuntime( 2948): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059) E/AndroidRuntime( 2948): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) E/AndroidRuntime( 2948): at android.app.ActivityThread.access$600(ActivityThread.java:130) E/AndroidRuntime( 2948): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195) E/AndroidRuntime( 2948): at android.os.Handler.dispatchMessage(Handler.java:99) E/AndroidRuntime( 2948): at android.os.Looper.loop(Looper.java:137) E/AndroidRuntime( 2948): at android.app.ActivityThread.main(ActivityThread.java:4745) E/AndroidRuntime( 2948): at java.lang.reflect.Method.invokeNative(Native Method) E/AndroidRuntime( 2948): at java.lang.reflect.Method.invoke(Method.java:511) E/AndroidRuntime( 2948): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) E/AndroidRuntime( 2948): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) E/AndroidRuntime( 2948): at dalvik.system.NativeStart.main(Native Method) E/AndroidRuntime( 2948): Caused by: android.view.InflateException: Binary XML file line #281: Error inflating class ImageButton E/AndroidRuntime( 2948): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704) E/AndroidRuntime( 2948): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746) E/AndroidRuntime( 2948): at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) E/AndroidRuntime( 2948): at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) E/AndroidRuntime( 2948): at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) E/AndroidRuntime( 2948): at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) E/AndroidRuntime( 2948): at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) E/AndroidRuntime( 2948): at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) E/AndroidRuntime( 2948): at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) E/AndroidRuntime( 2948): at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) E/AndroidRuntime( 2948): at android.view.LayoutInflater.parseInclude(LayoutInflater.java:830) E/AndroidRuntime( 2948): at android.view.LayoutInflater.rInflate(LayoutInflater.java:736) E/AndroidRuntime( 2948): at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) E/AndroidRuntime( 2948): at android.view.LayoutInflater.inflate(LayoutInflater.java:489) E/AndroidRuntime( 2948): at android.view.LayoutInflater.inflate(LayoutInflater.java:396) E/AndroidRuntime( 2948): at android.view.LayoutInflater.inflate(LayoutInflater.java:352) E/AndroidRuntime( 2948): at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:710) E/AndroidRuntime( 2948): at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:195) E/AndroidRuntime( 2948): at org.libreoffice.LibreOfficeMainActivity.onCreate(LibreOfficeMainActivity.java:131) E/AndroidRuntime( 2948): at android.app.Activity.performCreate(Activity.java:5008) E/AndroidRuntime( 2948): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079) E/AndroidRuntime( 2948): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023) E/AndroidRuntime( 2948): ... 11 more E/AndroidRuntime( 2948): Caused by: android.content.res.Resources$NotFoundException: File res/drawable/ic_incrementindent.xml from drawable resource ID #0x7f0800b4 E/AndroidRuntime( 2948): at android.content.res.Resources.loadDrawable(Resources.java:1923) E/AndroidRuntime( 2948): at android.content.res.TypedArray.getDrawable(TypedArray.java:601) E/AndroidRuntime( 2948): at android.widget.ImageView.<init>(ImageView.java:120) E/AndroidRuntime( 2948): at android.widget.ImageButton.<init>(ImageButton.java:87) E/AndroidRuntime( 2948): at androidx.appcompat.widget.AppCompatImageButton.<init>(AppCompatImageButton.java:78) E/AndroidRuntime( 2948): at androidx.appcompat.widget.AppCompatImageButton.<init>(AppCompatImageButton.java:73) E/AndroidRuntime( 2948): at androidx.appcompat.app.AppCompatViewInflater.createImageButton(AppCompatViewInflater.java:226) E/AndroidRuntime( 2948): at androidx.appcompat.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:141) E/AndroidRuntime( 2948): at androidx.appcompat.app.AppCompatDelegateImpl.createView(AppCompatDelegateImpl.java:1569) E/AndroidRuntime( 2948): at androidx.appcompat.app.AppCompatDelegateImpl.onCreateView(AppCompatDelegateImpl.java:1620) E/AndroidRuntime( 2948): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:675) E/AndroidRuntime( 2948): ... 32 more E/AndroidRuntime( 2948): Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #5: invalid drawable tag vector E/AndroidRuntime( 2948): at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:877) E/AndroidRuntime( 2948): at android.graphics.drawable.Drawable.createFromXml(Drawable.java:818) E/AndroidRuntime( 2948): at android.content.res.Resources.loadDrawable(Resources.java:1920) E/AndroidRuntime( 2948): ... 42 more W/ActivityManager( 1423): Force finishing activity org.libreoffice/.LibreOfficeMainActivity W/ActivityManager( 1423): Force finishing activity org.libreoffice/.ui.LibreOfficeUIActivity Change-Id: I3580faf5e4b1f55acdc3d32caa8a233bb09a14aa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144848 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-12-28android: Enable multidex, update com.google.android.material to 1.7.0Michael Weghorn
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-28android: Update compileSdkVersion/targetSdkVersion to 33Michael Weghorn
API version 33 refers to Android 13. I didn't notice anything requiring changes when quickly going over the release notes for all apps running on Android 13 [1] and apps targeting Android 13 [2]. [1] https://developer.android.com/about/versions/13/behavior-changes-all [2] https://developer.android.com/about/versions/13/behavior-changes-13 Change-Id: I8b68f3bf0afc4c00ecd3412a8fdf0581f2d6bbc0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144837 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-12-28android: Set namespace in build.gradle instead of manifestMichael Weghorn
Switch from the now deprecated way, as mentioned in commit 7347d911fa295c31262a0f576c5b2f3f14ce017d Author: Michael Weghorn <m.weghorn@posteo.de> Date: Fri Dec 23 18:29:44 2022 +0100 android: Update Android Gradle Plugin to 7.3.1 ... and gradle to 7.4. Relevant entry from the release notes [1] that will be addressed in a follow-up commit: > # Package attribute in manifest file is deprecated > > Starting with AGP 7.3.0-alpha04, if you use Gradle to build your > project, AGP generates a warning if you use the package attribute in the > manifest file. To set the namespace for your app, use the namespace > property in the module-level build.gradle file. To learn more, see Set a > namespace > [https://developer.android.com/studio/build/configure-app-module#set-namespace]. > > To get help moving to the new namespace DSL, use the AGP Upgrade > Assistant (Tools > AGP Upgrade Assistant). [1] https://developer.android.com/studio/releases/gradle-plugin#7-3-0 Change-Id: I8b196e53fb9b3fb7e9314719fdb7e0f2254abd10 Note that this is unrelated to the Android application ID [1] that can be set with autogen param `--with-android-package-name`. [1] https://developer.android.com/studio/build/configure-app-module#set-application-id Change-Id: I146dab19228d83b1beb6408743c0232e1ba1d060 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144836 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-12-28android: Include Impress's layout.xml into appMichael Weghorn
It's needed since commit daab698b346e5e40b67f1e15c796c4e399ccaf8a Date: Tue Nov 22 14:07:12 2022 +0200 sd: replace hardcoded table styles with xml file Without it being included into the app/APK, opening any presentation in Android Viewer file would fail, with this in ADB log: 12-27 10:22:45.329 9811 9862 E libo:sal/osl/unx/file: failed to open /assets/share/config/soffice.cfg/simpress/styles.xml 12-27 10:22:45.332 9811 9862 W svl.items: 1:svl/source/items/itempool.cxx:442: old secondary pool: EditEngineItemPool of pool: XOutdevItemPool must be empty. 12-27 10:22:45.337 9811 9862 I LOKitTileProvider: ====> mOffice.documentLoad() returned null, trying to restart 'Office' and loading again Change-Id: I677476bda146be2cd3ebe18da91bcb8f2a796fd3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144835 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-12-28android: Update Android Gradle Plugin to 7.3.1Michael Weghorn
... and gradle to 7.4. Relevant entry from the release notes [1] that will be addressed in a follow-up commit: > # Package attribute in manifest file is deprecated > > Starting with AGP 7.3.0-alpha04, if you use Gradle to build your > project, AGP generates a warning if you use the package attribute in the > manifest file. To set the namespace for your app, use the namespace > property in the module-level build.gradle file. To learn more, see Set a > namespace > [https://developer.android.com/studio/build/configure-app-module#set-namespace]. > > To get help moving to the new namespace DSL, use the AGP Upgrade > Assistant (Tools > AGP Upgrade Assistant). [1] https://developer.android.com/studio/releases/gradle-plugin#7-3-0 Change-Id: I8b196e53fb9b3fb7e9314719fdb7e0f2254abd10 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144834 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-12-23android: Add buttons to increase/decrease indentMichael Weghorn
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-20tdf#85592 android: .uno:BackColor deprecated, use .uno:CharBackColorJustin Luth
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-10-14WASM add Calc as optional build result, make it build & runBalazs Varga
Adding new config option: --with-main-module=<writer/calc> With this switcher we can build only WASM writer module or calc module. The default value is 'writer'. This commit also reverts: 26603bc9ef0116ed31c510dab82b69d3666447b5 (WASM fix orcus native exception handling (NEH)) Because Calc import is using liborcus for loading styles.xml. Change-Id: I4c330ef8eea7d08214bf357531ee0bf7383ab788 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137946 Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de> Tested-by: Jenkins
2022-09-08replace egrep/fgrep calls with grep -E/grep -FRene Engelhard
as egrep/fgrep is deprecated since long amd grep 3.8+ now actually warns (e.g. "egrep: warning: egrep is obsolescent; using grep -E") Change-Id: I5b10f05dffdd09081deb05cef974e3cdb2907315 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139614 Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> Tested-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
2022-08-08android: Add scrollbars.ui into APKMichael Weghorn
That UI file was added in commit 4bc62c4e9b5b4eab6e2e40577789c435dce59f66 Date: Thu Aug 4 15:33:51 2022 +0100 split SwScrollbar up for reuse of adaptor Include it for Android. Without it, trying to load/display any document would result in Android Viewer crashing or getting stuck, with this in the ADB log: 08-08 09:22:20.102 6064 6256 D libo:sal/osl/unx/file: double-slash in path: /assets//config/soffice.cfg/svt/ui/scrollbars.ui 08-08 09:22:20.102 6064 6256 E libo:sal/osl/unx/file: miss cache: failed to open /assets//config/soffice.cfg/svt/ui/scrollbars.ui 08-08 09:22:20.102 6064 6256 W vcl.builder: 23:vcl/source/window/builder.cxx:480: DBG_UNHANDLED_EXCEPTION in VclBuilder 08-08 09:22:20.102 6064 6256 W vcl.builder: when: Unable to read .ui file exception: void 08-08 09:22:20.103 6064 6256 I LOKitTileProvider: ====> mOffice.documentLoad() returned null, trying to restart 'Office' and loading again Change-Id: I0938d77dc9553d8acc7b2bdd4a72b5299b4ec1a5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137943 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-08-08android: Drop empty main.jni.srcDirs from sourceSetsMichael Weghorn
This was shown as a recommended step in Android Studio when the update to Android Gradle Plugin 7.2.2 was suggested: > *Remove jni source directory from sourceSets* > > The jni block in an android > sourceSet does nothing, and will be removed in Android Gradle Plugin > version 8.0.0. Change-Id: I3378926047d5ad86548d0bf800e022b74efb5e09 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137942 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-08-08android: Update Android Gradle Plugin to 7.2.2Michael Weghorn
Change-Id: I3235716498168ca5eebf71ebf6f5ee571af7a72d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137941 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-06-22Revert changes to android/mobile-config.pyIlmari Lauhakangas
made in 157298bb808a943616991927f9370a86c1f2ca48 Got Tinderbox failure with Traceback (most recent call last): File "/opt/rh/rh-python36/root/usr/lib64/python3.6/xml/etree/ElementPath.py", line 263, in iterfind selector = _cache[cache_key] KeyError: ('%(component-schema)s[@%(name)s="Common"]/component/group[@%(name)s= "Filter"]/group[@%(name)s="Microsoft"]/group[@{http://openoffice.org/2001/registry} name="Import"]/prop', None) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/tinderbox/buildslave/source/libo-master/android/mobile-config.py", line 85, in <module> props = root.findall(microsoftImport) File "/opt/rh/rh-python36/root/usr/lib64/python3.6/xml/etree/ElementPath.py", line 304, in findall return list(iterfind(elem, path, namespaces)) File "/opt/rh/rh-python36/root/usr/lib64/python3.6/xml/etree/ElementPath.py", line 277, in iterfind selector.append(ops[token[0]](next, token)) KeyError: '(' Change-Id: I34a770a342417fcbfb9689e3adc4b495d5bd5fe5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136282 Tested-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org> Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
2022-06-22android and bin/update: make pythonicLukas
Change-Id: Iaf791bfa8d9822843b26f2a2f2c3d94c55a60a0b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133358 Reviewed-by: Arkadiy Illarionov <qarkai@gmail.com> Tested-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org> Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
2022-06-14android: Update com.google.android.material to 1.6.1Michael Weghorn
Change-Id: If5aebe347534745065b371190abffce2421655f9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135729 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-05-28android: Update Android Gradle Plugin to 7.2.1Michael Weghorn
Release notes [1]: > 7.2.1 (May 2022) > > This minor update corresponds to the release of Android Studio > Chipmunk Patch 1 and includes the following bug fixes: > > bundletool does not package baseline profiles correctly [2] > > To see the other bug fixes included in this release, see the Android > Studio Chipmunk Patch 1 release notes. [3] [1] https://developer.android.com/studio/releases/gradle-plugin?buildsystem=ndk-build#7-2-0 [2] https://issuetracker.google.com/issues/230361284 [3] https://developer.android.com/studio/releases#patch-releases Change-Id: I57f37ea3786003dba4d95b291ddf6b0b44dccaa4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135053 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-05-26android: Update compileSdkVersion/targetSdkVersion to 32Michael Weghorn
API version 32 refers to the Android 12L feature drop (Android 12.1). According to [1], "12L is a special feature drop that makes Android 12 even better on tablets and foldable devices." When getting over the list of behavior changes for apps targeting Android 12, I didn't realize anyting relevant specific to API level 32 not yet in API level 31 as well, so there seems to be no need for any special adjustments for this update on top of commit 2ab389b251744fa7f3f6b060c09746e59d87f3b1 Date: Tue Apr 19 10:33:27 2022 +0200 android: Update compileSdkVersion/targetSdkVersion to 31 [1] https://developer.android.com/about/versions/12/12L Change-Id: Ic99c4ee5b81b6584648fa4717e23cc7f3c78bdab Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134988 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-05-26android: Update androidx.constraintlayout to 2.1.4Michael Weghorn
Change-Id: If2edff8006c3aa904d40dabf679d5ed0b0fd0127 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134987 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-05-26android: Update com.google.android.material to 1.6.0Michael Weghorn
Change-Id: Iac3831d400d29b45be82d2585ca1454ed22676be Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134986 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-05-21android: Drop 'android.enableJetifier=true'Michael Weghorn
From the Android Gradle Plugin 7.2.0 release notes [1]: > Jetifier warning and check in Build Analyzer Build Analyzer now displays > a warning if your project's gradle.properties file includes > android.enableJetifier=true. This flag was introduced in a previous > version of Android Studio to enable AndroidX for libraries that don't > support AndroidX natively. However, the library ecosystem has mostly > moved to support AndroidX natively and the Jetifier flag is probably no > longer needed by your project. Additionally, the flag can lead to slower > build performance. If you see this warning, you can run a check within > Build Analyzer to confirm if the flag can be removed. Android Viewer has no dependencides requiring Android Support Libraries, so drop the `android.enableJetifier=true` flag. [1] https://developer.android.com/studio/releases/gradle-plugin?buildsystem=ndk-build#jetifier-build-analyzer Change-Id: I6943b2e82e5b226286be288f9ed30944c541eb1c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134673 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-05-21android: Update Android Gradle Plugin to 7.2.0Michael Weghorn
... and gradle to 7.3.3, as suggested by Android Studio. The Android Gradle plugin release notes for 7.2.0 [1] mention a new warning in Build Analyzer when `android.enableJetifier=true` is set. That will be handled in a follow-up commit. [1] https://developer.android.com/studio/releases/gradle-plugin?buildsystem=ndk-build#jetifier-build-analyzer Change-Id: I9427f8b878346edc3c6e30be1d41fcc4dc32540e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134672 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-05-09Fix typo in codeAndrea Gelmini
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-08android: Don't use res Id in switch-case (ToolbarController)Michael Weghorn
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-08android: Don't use res ID in switch-case (SearchController)Michael Weghorn
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-08android: Avoid using res ID in switch-case (FormattingController)Michael Weghorn
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-08android: Allow setting auto font/bg colorMichael Weghorn
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-08android: Handle auto color as suchMichael Weghorn
When no color is explicitly set for the font/background (i.e. automatic color is used which would e.g. be black for the font if no background color is set or white if a black highlight color is set in Writer), the value for the color sent in the ".uno:Color" event for the font color and similarly for the background/highlight color (".uno:BackgroundColor" in Calc, ".uno:CharBackColor" in Impress, ".uno:BackColor" in Writer) is -1. The previous handling of that special value was problematic: 1) Where handled specifically, -1 was interpreted as "black color" rather than "auto/no color". 2) The color handled by the above-mentioned UNO events does not contain/handle the alpha channel, while Android does, so a conversion happens to add/remove the alpha layer. However, the anonymous `ColorPaletteListener`s that handle font and background color updates in their `updateColorPickerPosition` methods were not doing a logical or to add an alpha channel to the LO-provided color, but *adding* 0xFF000000 instead, which is the same for actual colors without an alpha channel set, but the actual special value of -1 (0xFFFFFFFF) would then be converted to 0xFEFFFFFF and no longer be treated as special. The way of treating -1 as black would also have the side effect that an explicit white color (0x00FFFFFF) would be converted to 0xFFFFFFFF, which is -1, and would therefore be treated as black. (So setting font color to white would result in black being shown as font color in the font color UI in experimental mode instead...) In order to actually handle auto color as such, handle the special value of -1 right in the `updateColorPickerPosition` methods: In that case, unselect any explicitly selected color (and set color to transparent for the buttons in the "Style" tab of the toolbar, `font_color_picker_button` and `font_back_color_picker_button` in `toolbar_bottom.xml`). Also, do a logical or to add the alpha layer instead of adding 0xFF000000. While at it, unify the code in the two `updateColorPickerPosition` methods a bit. Change-Id: I2e6512f32e671f92c8d31b2780c350dd74fb0747 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133992 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-05-08android: Don't show any color in palette as selected if none matchesMichael Weghorn
In Android Viewer with experimental editing mode enabled, doing the following resulted in black still being marked as the current font color in the "Style" -> "Font Color" UI. 1) create a new Writer doc in the desktop version with one paragraph that has the font color explicitly set to black and one with "Dark Brick 2" 2) open the doc in Android Viewer with experimental mode enabled 3) tap on the first paragraph with font color explicitly set to black 4) open the "Style" -> "Font Color" UI where the color could be changed (layout file: `toolbar_color_picker.xml`) -> black is marked as current font color (OK) 5) tap on the paragraph which has font color "Dark Brick 2" set -> black is still marked as current font color (NOK) This is because the indices of the previously set color would just remain set if the new color was not found in any of the palettes which contain a set of predefined colors. Change that to set the index for the `upperSelectedBox` palette to 0 (i.e. switch to the first palette), and the index of the `selectedBox` (i.e. color within the palette) to the special value of '-1' and don't mark any palette or color as selected in that case. The newly introduced `ColorPickerAdapter#unselectColors` will be used from elsewhere in a follow-up commit, so make it public right away. The two `ImageButton`s right in the "Style" tab in the toolbar (i.e. `font_color_picker_button` and `font_back_color_picker_button` in `toolbar_bottom.xml`) remain unchanged and keep showing the actual color, since those are not restricted to predefined colors in the palettes. For the case where no explicit font color is set (i.e. use of automatic font color, e.g. black if no background is set, but white if the background is set to black), the value '-1' is sent from the C++ side, and no color should be marked as selected in Android Viewer, which also works with this change in place in general. However, the current handling for the "automatic color" case on Android Viewer side looks suspicious in more ways that will be addressed in a follow-up commit. Change-Id: I228d57ace5341bd311761f40c477441d1e511d5d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133989 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-05-08android: Switch order of these if/else statementsMichael Weghorn
I find if (a == b) { // statement 1 } else { // statement 2 } more straightforward than if ( a != b) { // statement 2 } else { // statement 1 } since it doesn't require logically negating twice (else block is for `!(a != b)`) in the second form), and this also prepares for a follow-up commit where one of the conditions will be extended further. Change-Id: I1d2177bdcf662994e757b626983a9f9626c66aa1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133988 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>