summaryrefslogtreecommitdiff
path: root/android
AgeCommit message (Collapse)Author
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>
2022-05-08android: Don't store selected pos in ColorPickerAdapterMichael Weghorn
The position is already set and used in `ColorPaletteAdapter` as its `upperSelectedBox` member, so stop doing the double bookkeeping in both classes and retrieve it from there instead. Change-Id: I59896b85f5d5a0285076f61599be64638fa71121 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133987 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-05-08android: Make Color{Palette,Picker}Adapter members privateMichael Weghorn
... and make some `final` as well. Change-Id: Ib50ff32788edaea753cc25f119f91a93e936b2ef Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133986 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-05-08android: Drop explicit type arguments when calling ctorsMichael Weghorn
Addresses these suggestions shown in Android Studio: * "Explicit type argument String can be replaced with <>" * "Explicit type argument String, ArrayList<String> can be replaced with <>" Change-Id: Ibc78364cf5b246d8c1e1d32d755c3e8dcf0e32aa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133985 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-05-08android: Move assignment to existing loopMichael Weghorn
There is already a loop just before this one, so just move that assignment there as well. Change-Id: Ie93a0275c0940b7932973264352bad64d0489b03 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133984 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-05-08android: Use existing Color.WHITE constantMichael Weghorn
... instead of creating the color from the RGB values manually. Change-Id: I2058de553e2e744440e7d856ca9bfaf5f9041b49 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133983 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-05-04android: Don't use log tag longer than 23 charsMichael Weghorn
Addresses this lint error: > .../android/source/src/java/org/mozilla/gecko/gfx/SimpleScaleGestureDetector.java:146: > Error: The logging tag can be at most 23 characters, was 31 > (GeckoSimpleScaleGestureDetector) [LongLogTag] > Log.e(LOGTAG, "No gesture taking place in getFocusX()!"); Change-Id: I1d18fb3717ccea8dc36695bfef888d035efe8d55 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133799 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-05-04android: Make clear that column index is non-negativeMichael Weghorn
Use `Cursor#getColumnIndexOrThrow` instead of `Cursor#getColumnIndex` here, as suggested in the `Cursor#getColumnIndex` doc [1]: > Returns the zero-based index for the given column name, or -1 if the > column doesn't exist. If you expect the column to exist use > getColumnIndexOrThrow(java.lang.String) instead, which will make the > error more clear. As described in the `OpenableColumns` doc [2], `OpenableColumns.DISPLAY_NAME` is one of the two standard columns that must be supported: > These are standard columns for openable URIs. Providers that serve > openable URIs must support at least these columns when queried. Addresses this lint error: > .../android/source/src/java/org/libreoffice/ui/FileUtilities.java:139: Error: Value must be ≥ 0 [Range] > displayName = cursor.getString(cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME)); > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > Explanation for issues of type "Range": > Some parameters are required to in a particular numerical range; this check > makes sure that arguments passed fall within the range. For arrays, Strings > and collections this refers to the size or length. [1] https://developer.android.com/reference/android/database/Cursor#getColumnIndex(java.lang.String) [2] https://developer.android.com/reference/android/provider/OpenableColumns Change-Id: I946fcd32a905a4bb8c0527fc1199b9dcc52bccfc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133798 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-05-04android: Call base class implementation in 'onActivityResult'Michael Weghorn
Addresses this lint error: > android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java:253: Error: > Overriding method should call super.onActivityResult [MissingSuperCall] > protected void onActivityResult(int requestCode, int resultCode, Intent data) { > ~~~~~~~~~~~~~~~~ > > Explanation for issues of type "MissingSuperCall": > Some methods, such as View#onDetachedFromWindow, require that you also call > the super implementation as part of your method. Change-Id: Iab2bdadae7a776e4f52d671a6fd47c1b8146b2a6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133797 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-04-30android: Show Impress icon for .pps filesMichael Weghorn
For some reason, that was commented out. Opening such a PowerPoint file worked just fine, and with this commit in place, the Impress icon is shown in the "Recent Files" view as well. Change-Id: I69bce54074c084928d9aa7b95f37145a9692b847 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133649 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-04-30tdf#111427 android: Enable support for .ppsxMichael Weghorn
Opening the sample file of MIME type "application/vnd.openxmlformats-officedocument.presentationml.slideshow" attached to tdf#111427 worked fine now when testing in an x86_64 AVD with API level 31, so declare support for it. Change-Id: I67ace0fb6ee82c0a43624dc32671ba2d453e473c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133648 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-04-27android: Slightly clean up style of LOKitTileProvider#resetPartsMichael Weghorn
* Reduce scope of the `parts` variable to the if block * add an emptly line before the next method Change-Id: I22389cb4c9307f6888c4ed836056caf23ce84da6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133450 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-04-27android: Reuse existing LOKitTileProvider#resetPartsMichael Weghorn
... instead of duplicating what it does in `LOKitTileProvider#postLoad`. Change-Id: I0ed3d77d9f9651efec764eafeaa3f71576abcf6e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133449 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-04-27android: Leave part names starting with "Sheet" etc. intactMichael Weghorn
It's unexpected that opening a Calc sheet with two tables called "Sheet foobar" and "Sheet 10" would result in the sheets showing up as "Sheet 1" and "Sheet 2" in the parts view instead of their real names. Therefore, leave the original names intact and show them instead of generating new generic names. The change to rename such sheets (and similar parts) has been added in commit 1239dce2595877ad64fd8c8fd927ea4285d69abe Date: Thu Nov 1 22:03:31 2018 +0300 [Pardus] language improvements on Android More hardcoded strings extrated to the resource file Few Turkish language improvements This patch is sponsored by ULAKBIM/Pardus project. where the intention seems to have been to have a localized name for the parts show up. That still happens when the part name is empty (s. lines above), but I think that explicit names should remain as they are, as e.g. also happens for Calc sheets in the desktop version of LibreOffice. Change-Id: I3073babf99a6b2309be2107141bba92236eba76d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133448 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-04-26android: Use 'if' instead of switch-cases with just 1 caseMichael Weghorn
... which IMHO makes this a bit more readable. Change-Id: Ica1d9416f711e75e6d6c23963ca64d13e08c138e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133428 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-04-26android: Drop redundant check for SDK version <= 11Michael Weghorn
minSdkVersion is 16. Change-Id: I1082cc5abd7ecc02211509e57fd41c97cf706e8a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133427 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-04-21android: Show file chooser despite package visibility filtering in API 30Michael Weghorn
While it was working just fine in my x86_64 AVD with API level 31, opening the the file chooser on a real HW aarch64 device running Android 12 no longer worked by tapping on the TextView in `LibreOfficeUIActivity` after updating target API from 28 to 31 in commit 2ab389b251744fa7f3f6b060c09746e59d87f3b1 Date: Tue Apr 19 10:33:27 2022 +0200 android: Update compileSdkVersion/targetSdkVersion to 31 The intent.resolveActivity(getPackageManager()) != null check was failing there, so the Activity with `Intent.ACTION_OPEN_DOCUMENT` wasn't started there. This looks like an issue due to package visibility filtering introduced in target API level 30. Quoting from [1]: > When an app targets Android 11 (API level 30) or higher and queries for > information about the other apps that are installed on a device, the > system filters this information by default. The limited package > visibility reduces the number of apps that appear to be installed on a > device, from your app's perspective. > > [...] > > The limited app visibility affects the return results of methods that > give information about other apps, such as queryIntentActivities(), > getPackageInfo(), and getInstalledApplications(). The limited > visibility also affects explicit interactions with other apps, such > as starting another app's service. From how I understand it, the check is used to make sure that there is an app that can handle the Intent, as e.g. the "Android fundamentals 02.3: Implicit intents" tutorial [2] mentions it for the example using an `Intent.ACTION_VIEW`: > Use the resolveActivity() method and the Android package manager to find > an Activity that can handle your implicit Intent. Make sure that the > request resolved successfully. > > if (intent.resolveActivity(getPackageManager()) != null) { > } > > This request matches your Intent action and data with the Intent filters > for installed apps on the device. You use it to make sure there is at > least one Activity that can handle your requests. While that sounds reasonable to make sure there is an app that can view specific data passed *from* the app (and [3] describes how to add a corresponding `<queries>` element to make this use case work), it seems to be unnecessary for `Intent.ACTION_OPEN_DOCUMENT`, since that causes the system to "display the various DocumentsProvider instances installed on the device, letting the user navigate through them" and Android presumably at least provides a provider for handling local files by itself in any case. The `Intent.ACTION_GET_CONTENT` case used instead of `Intent.ACTION_OPEN_DOCUMENT` for API level < 19 should presumably be similar. Anyway, in case there should still be any case where the Intent cannot be handled: `startActivityForResult` "throws ActivityNotFoundException if there was no Activity found to run the given Intent." [4], so add a try-catch block handling that exception instead of the previous check. [1] https://developer.android.com/training/package-visibility [2] https://developer.android.com/codelabs/android-training-activity-with-implicit-intent?index=..%2F..android-training#3 [3] https://developer.android.com/training/package-visibility/use-cases#open-a-file [4] https://developer.android.com/reference/android/app/Activity#startActivityForResult(android.content.Intent,%20int) Change-Id: I7702b100d71333be2d78df1bc81ef2e5a7e016bd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133272 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-04-21android: Slightly improve style in use of arraysMichael Weghorn
Addresses these warnings shown in Android Studio for class `LibreOfficeUIActivity`: * "Unnecessary 'Arrays.asList()' call" * "Raw use of parameterized class 'ArrayList'" * "Explicit type argument ShortcutInfo can be replaced with <>" Change-Id: I083e5fcf804209fae704b19643ce80bc92126ca8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133271 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-04-21android: Drop unused import and extra semicolonMichael Weghorn
Change-Id: I19557b0b1d63698a31dac61ce9fde3ce07f86451 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133267 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-04-21android: Avoid using resource ID in switch-caseMichael Weghorn
Adresses this warning shown in Android Studio: > Resource IDs will be non-final by default in Android Gradle Plugin > version 8.0, avoid using them in switch case statements Change-Id: I8cead0ceb3b71e263b29d4283a8cfac522ed4204 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133266 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-04-21android: Explicitly load libc++_sharedMichael Weghorn
While it works just fine without that in newer Android versions, trying to open any doc in an x86 AVD with API level 16 failed like this: > E/AndroidRuntime( 2999): java.lang.ExceptionInInitializerError > E/AndroidRuntime( 2999): at org.libreoffice.TileProviderFactory.initialize(TileProviderFactory.java:23) > E/AndroidRuntime( 2999): at org.libreoffice.LOKitThread.<init>(LOKitThread.java:39) > E/AndroidRuntime( 2999): at org.libreoffice.LibreOfficeMainActivity.onCreate(LibreOfficeMainActivity.java:149) > E/AndroidRuntime( 2999): at android.app.Activity.performCreate(Activity.java:5008) > E/AndroidRuntime( 2999): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079) > E/AndroidRuntime( 2999): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023) > E/AndroidRuntime( 2999): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) > E/AndroidRuntime( 2999): at android.app.ActivityThread.access$600(ActivityThread.java:130) > E/AndroidRuntime( 2999): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195) > E/AndroidRuntime( 2999): at android.os.Handler.dispatchMessage(Handler.java:99) > E/AndroidRuntime( 2999): at android.os.Looper.loop(Looper.java:137) > E/AndroidRuntime( 2999): at android.app.ActivityThread.main(ActivityThread.java:4745) > E/AndroidRuntime( 2999): at java.lang.reflect.Method.invokeNative(Native Method) > E/AndroidRuntime( 2999): at java.lang.reflect.Method.invoke(Method.java:511) > E/AndroidRuntime( 2999): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) > E/AndroidRuntime( 2999): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) > E/AndroidRuntime( 2999): at dalvik.system.NativeStart.main(Native Method) > E/AndroidRuntime( 2999): Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: link_image[1891]: 1176 could not load needed library 'libc++_shared.so' for 'liblo-native-code.so' (load_library[1093]: Library 'libc++_shared.so' not found) > E/AndroidRuntime( 2999): at java.lang.Runtime.loadLibrary(Runtime.java:370) > E/AndroidRuntime( 2999): at java.lang.System.loadLibrary(System.java:535) > E/AndroidRuntime( 2999): at org.libreoffice.kit.NativeLibLoader.load(LibreOfficeKit.java:105) > E/AndroidRuntime( 2999): at org.libreoffice.kit.LibreOfficeKit.<clinit>(LibreOfficeKit.java:82) > E/AndroidRuntime( 2999): ... 17 more > W/ActivityManager( 1421): Force finishing activity org.libreoffice/.LibreOfficeMainActivity > W/ActivityManager( 1421): Force finishing activity org.libreoffice/.ui.LibreOfficeUIActivity Change-Id: I6e383e624b9e66c0daa9ecfda4a3b176c8fa0d94 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133263 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-04-21android: Use drawable tag already supported with API level 16Michael Weghorn
Use the `app:drawableLeftCompat` tag instead of `android:drawableLeft` to set the icon to show in the TextView. With the latter, trying to start Android Viewer in an x86 AVD with API level 16 resulted in this crash: > E/AndroidRuntime( 2510): java.lang.RuntimeException: Unable to start activity ComponentInfo{org.libreoffice/org.libreoffice.ui.LibreOfficeUIActivity}: android.view.InflateException: Binary XML file line #80: Error inflating class TextView > E/AndroidRuntime( 2510): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059) > E/AndroidRuntime( 2510): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) > E/AndroidRuntime( 2510): at android.app.ActivityThread.access$600(ActivityThread.java:130) > E/AndroidRuntime( 2510): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195) > E/AndroidRuntime( 2510): at android.os.Handler.dispatchMessage(Handler.java:99) > E/AndroidRuntime( 2510): at android.os.Looper.loop(Looper.java:137) > E/AndroidRuntime( 2510): at android.app.ActivityThread.main(ActivityThread.java:4745) > E/AndroidRuntime( 2510): at java.lang.reflect.Method.invokeNative(Native Method) > E/AndroidRuntime( 2510): at java.lang.reflect.Method.invoke(Method.java:511) > E/AndroidRuntime( 2510): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) > E/AndroidRuntime( 2510): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) > E/AndroidRuntime( 2510): at dalvik.system.NativeStart.main(Native Method) > E/AndroidRuntime( 2510): Caused by: android.view.InflateException: Binary XML file line #80: Error inflating class TextView > E/AndroidRuntime( 2510): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704) > E/AndroidRuntime( 2510): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746) > E/AndroidRuntime( 2510): at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) > E/AndroidRuntime( 2510): at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) > E/AndroidRuntime( 2510): at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) > E/AndroidRuntime( 2510): at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) > E/AndroidRuntime( 2510): at android.view.LayoutInflater.inflate(LayoutInflater.java:489) > E/AndroidRuntime( 2510): at android.view.LayoutInflater.inflate(LayoutInflater.java:396) > E/AndroidRuntime( 2510): at android.view.LayoutInflater.inflate(LayoutInflater.java:352) > E/AndroidRuntime( 2510): at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:696) > E/AndroidRuntime( 2510): at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:170) > E/AndroidRuntime( 2510): at org.libreoffice.ui.LibreOfficeUIActivity.createUI(LibreOfficeUIActivity.java:169) > E/AndroidRuntime( 2510): at org.libreoffice.ui.LibreOfficeUIActivity.onCreate(LibreOfficeUIActivity.java:147) > E/AndroidRuntime( 2510): at android.app.Activity.performCreate(Activity.java:5008) > E/AndroidRuntime( 2510): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079) > E/AndroidRuntime( 2510): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023) > E/AndroidRuntime( 2510): ... 11 more > E/AndroidRuntime( 2510): Caused by: android.content.res.Resources$NotFoundException: File res/drawable-hdpi-v4/ic_folder_grey_48dp.xml from drawable resource ID #0x7f080083 > E/AndroidRuntime( 2510): at android.content.res.Resources.loadDrawable(Resources.java:1923) > E/AndroidRuntime( 2510): at android.content.res.TypedArray.getDrawable(TypedArray.java:601) > E/AndroidRuntime( 2510): at android.widget.TextView.<init>(TextView.java:614) > E/AndroidRuntime( 2510): at androidx.appcompat.widget.AppCompatTextView.<init>(AppCompatTextView.java:100) > E/AndroidRuntime( 2510): at androidx.appcompat.widget.AppCompatTextView.<init>(AppCompatTextView.java:95) > E/AndroidRuntime( 2510): at androidx.appcompat.app.AppCompatViewInflater.createTextView(AppCompatViewInflater.java:194) > E/AndroidRuntime( 2510): at androidx.appcompat.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:115) > E/AndroidRuntime( 2510): at androidx.appcompat.app.AppCompatDelegateImpl.createView(AppCompatDelegateImpl.java:1551) > E/AndroidRuntime( 2510): at androidx.appcompat.app.AppCompatDelegateImpl.onCreateView(AppCompatDelegateImpl.java:1602) > E/AndroidRuntime( 2510): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:675) > E/AndroidRuntime( 2510): ... 26 more > E/AndroidRuntime( 2510): Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #1: invalid drawable tag vector > E/AndroidRuntime( 2510): at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:877) > E/AndroidRuntime( 2510): at android.graphics.drawable.Drawable.createFromXml(Drawable.java:818) > E/AndroidRuntime( 2510): at android.content.res.Resources.loadDrawable(Resources.java:1920) > E/AndroidRuntime( 2510): ... 35 more > W/ActivityManager( 1421): Force finishing activity org.libreoffice/.ui.LibreOfficeUIActivity Change-Id: I4253a68f90d6c507805c7bf72aaf81011fb19339 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133256 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-04-21android: use mavenCentral instead of jcenter repositoryMichael Weghorn
From the `./gradlew --warning-mode all assembleStrippedUIEditingRelease` output: > > Configure project : > The RepositoryHandler.jcenter() method has been deprecated. This is > scheduled to be removed in Gradle 8.0. JFrog announced JCenter's sunset > in February 2021. Use mavenCentral() instead. Consult the upgrading > guide for further information: > https://docs.gradle.org/7.2/userguide/upgrading_version_6.html#jcenter_deprecation > at build_a6ed945jjgv6miyybz50fclhq$_run_closure1$_closure2.doCall(/home/michi/development/git/libreoffice-WORKTREE-for-android-x86/android/source/build.gradle:14) > (Run with --stacktrace to get the full stack trace of this deprecation warning.) Change-Id: I5db84a9778b598d1e3459dd313aa05c229060368 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133239 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-04-20android: Use android.ndkPath property to set path to NDKMichael Weghorn
Quoting from commit 128de1949ff120ac925dbb06e398fa992fb295ba Date: Tue Apr 19 15:18:49 2022 +0200 android: Use property instead of ANDROID_NDK_HOME env var which ported from an obsolete (no longer supported by current Gradle versions) way of setting the NDK path to a deprecated but still supported one as an intermediate step to allow upgrading Gradle: > Note however, that with this approach of using the `ndk.dir` > property instead of the suggested `android.ndkVersion` > (with the latter having the stricter requirement that > the `ndk` dir would have to be a subdir of the SDK dir), > doing the actual upgrade to a newer Gradle (plugin) version > in follow-up commit > Change-Id Ia982d72d877e229c3006c6d528b830d16c88481f > "android: Update Android Gradle Plugin to 7.1.3" > revealed that the use of the `ndk.dir` property > is deprecated in newer Gradle (plugin) versions as well, > resulting in this warning. > > > > Task :stripStrippedUIDebugDebugSymbols > > [CXX5106] NDK was located by using ndk.dir property. This method is > > deprecated and will be removed in a future release. Please delete > > ndk.dir from local.properties and set android.ndkVersion to > > [20.0.5594570] in all native modules in the project. > > https://developer.android.com/r/studio-ui/ndk-dir > > It might make sense to address that in a follow-up step, > but for now, it's an improvement and keeps it working > after the upgrade without potentially causing any incompatibility > problems with existing autogen configurations, > while support for the `ANDROID_NDK_HOME` env var that was > used so far seems to have been dropped, [...]. The release notes for Android Gradle Plugin version 4.1.0 mention yet another way of setting an explicit NDK path instead of just a version and that one is still supported and not deprecated [1]: > # Set the NDK path > You can set the path to your local NDK installation using the > android.ndkPath property in your module's build.gradle file. > > android { > ndkPath "your-custom-ndk-path" > } > > If you use this property together with the android.ndkVersion property, > then this path must contain an NDK version that matches > android.ndkVersion. Therefore, switch to setting the NDK path using the `android.ndkPath` property in liboSettings.gradle instead of the deprecated `ndk.dir` in local.properties. [1] https://developer.android.com/studio/releases/gradle-plugin?buildsystem=ndk-build#ndk-path Change-Id: I34690ca8e15ff4742bab9a716a58b9ad85fa86e7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133197 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-04-20android: Set archivesBaseName differently after gradle updateMichael Weghorn
Setting the archive base name in build.gradle using project.ext.set("archivesBaseName", "LibreOfficeViewer") no longer worked after commit 39326bc7d439170dd24c9d4b837c2cdb720b5d6f Date: Tue Apr 19 15:49:53 2022 +0200 android: Update Android Gradle Plugin to 7.1.3 ... and gradle to 7.2, which is what Android Studio suggested and did automatically when confirming. As a consequence, the generated .apk or .aar files would no longer have the app name in them, but be called e.g. "source-strippedUIEditing-release-unsigned.apk" instead of "LibreOfficeViewer-strippedUIEditing-release-unsigned.apk". Setting `archivesBaseName` in `android.defaultConfig` in libOSettings.gradle works, so move it there. Change-Id: Id03cbe10681aca85c35aeef64527bc7707c95736 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133191 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-04-20android: Update dependencies to current versionsMichael Weghorn
This requires the Gradle update from Change-Id Ia982d72d877e229c3006c6d528b830d16c88481f "android: Update Android Gradle Plugin to 7.1.3" as a prerequisite, since the build would otherwise fail with > > Task :desugarStrippedUIDebugFileDependencies FAILED > D8: Method name '$private$<clinit>' in class > 'com.sun.star.frame.XMenuBarMergingAcceptor$-CC' cannot be represented > in dex format. > > FAILURE: Build failed with an exception. after updating only the dependencies. Change-Id: Ifa007fa0e520e9494ace173d1643abb7d7a5f9c6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133183 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-04-20android: Drop obsolete "sourceCompatibility 6"Michael Weghorn
This addresses this warning when building Android Viewer: > > Task :compileStrippedUIDebugJavaWithJavac > warning: [options] source value 6 is obsolete and will be removed in a future release > warning: [options] To suppress warnings about obsolete options, use -Xlint:-options. Change-Id: Ic1a80117e7e8c31774947729452bfafacd7a24c8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133182 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-04-20android: Update Android Gradle Plugin to 7.1.3Michael Weghorn
... and gradle to 7.2, which is what Android Studio suggested and did automatically when confirming. Also apply the following optional, but recommended change while doing so: > Migrate from lintOptions to lint > Configuration related to lint is now performed using the lint block. Change-Id: Ia982d72d877e229c3006c6d528b830d16c88481f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133179 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-04-20android: Stop using ANDROID_SDK_HOME env variableMichael Weghorn
Otherwise, upgrading to Android Gradle Plugin 7.1.3 and gradle 7.2 (which will be done in a follow-up commit) would make the build fail like this: > FAILURE: Build failed with an exception. > > * Where: > Build file '/home/michi/development/git/libreoffice-WORKTREE-for-android-x86/android/source/build.gradle' line: 1 > > * What went wrong: > A problem occurred evaluating root project 'source'. > > Failed to apply plugin 'com.android.internal.application'. > > ANDROID_SDK_HOME is set to the root of your SDK: /home/michi/Android/Sdk > ANDROID_SDK_HOME was meant to be the parent path of the preference folder expected by the Android tools. > It is now deprecated. > > To set a custom preference folder location, use ANDROID_USER_HOME. > > It should NOT be set to the same directory as the root of your SDK. > To set a custom SDK location, use ANDROID_HOME. We don't actually rely on `ANDROID_SDK_HOME` being evaluated by the Android toolchain, but it used to be set in configure.ac, and the value was then assigned to the `sdk.dir` property written to `android/source/local.properties`. Just use a new variable name `ANDROID_SDK_DIR` and keep the mechanism otherwise unchanged for now. Change-Id: I44826621a1342119d40036fb704d8ff1eeed7c77 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133178 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-04-20android: Use property instead of ANDROID_NDK_HOME env varMichael Weghorn
Write an `ndk.dir` property with the directory path to `android/source/local.properties` instead, similar to how it's done for `sdk.dir`. Also, rename the `ANDROID_NDK_HOME` variable that's assigned in configure.ac that holds the corresponding value to `ANDROID_NDK_DIR`, because the gradle warning still shows up if that environment variable is set in addition to having an `ndk.dir` property in `local.properties`. This makes the following gradle warning disappear: > > Task :stripStrippedUIDebugDebugSymbols > WARNING: Support for ANDROID_NDK_HOME is deprecated and will be removed in the future. Use android.ndkVersion in build.gradle instead. > Support for ANDROID_NDK_HOME is deprecated and will be removed in the future. Use android.ndkVersion in build.gradle instead. Note however, that with this approach of using the `ndk.dir` property instead of the suggested `android.ndkVersion` (with the latter having the stricter requirement that the `ndk` dir would have to be a subdir of the SDK dir), doing the actual upgrade to a newer Gradle (plugin) version in follow-up commit Change-Id Ia982d72d877e229c3006c6d528b830d16c88481f "android: Update Android Gradle Plugin to 7.1.3" revealed that the use of the `ndk.dir` property is deprecated in newer Gradle (plugin) versions as well, resulting in this warning. > > Task :stripStrippedUIDebugDebugSymbols > [CXX5106] NDK was located by using ndk.dir property. This method is > deprecated and will be removed in a future release. Please delete > ndk.dir from local.properties and set android.ndkVersion to > [20.0.5594570] in all native modules in the project. > https://developer.android.com/r/studio-ui/ndk-dir It might make sense to address that in a follow-up step, but for now, it's an improvement and keeps it working after the upgrade without potentially causing any incompatibility problems with existing autogen configurations, while support for the `ANDROID_NDK_HOME` env var that was used so far seems to have been dropped, resulting in > > Task :stripStrippedUIDebugDebugSymbols > Unable to strip the following libraries, packaging them as they are: > libc++_shared.so, libfreebl3.so, liblo-native-code.so, libnspr4.so, > libnss3.so, libnssckbi.so, libnssdbm3.so, libnssutil3.so, > libplc4.so, libplds4.so, libsmime3.so, libsoftokn3.so, > libsqlite3.so, libssl3.so. instead if upgrading gradle without switching to the use of the property. Change-Id: I4a090e8736dac80777f69b0e12819b9c056f582b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133177 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-04-20android: Remove redundant label attribute from activitiesMichael Weghorn
Android Studio was showing an info/warning in the "Problems" pane that this label is redundant, so remove it. (The app name is used by default if nothing else is specified anyway.) Change-Id: I799c681488b95e2fffe89b59e7de18febe654dcb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133174 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-04-20android: Update compileSdkVersion/targetSdkVersion to 31Michael Weghorn
Google Play now requires that apps target API level 30 or higher, and compileSdkVersion/targetSdkVersion 31 is also needed to update the com.google.android.material dependency to >= 1.5.0 [1]. Explicitly set the `android:exported="true"` attribute for activities which is required when targeting Android 12 or newer; quoting from the list of behavior changes for apps targeting Android 12 [1]: > Safer component exporting > > If your app targets Android 12 or higher and contains activities, > services, or broadcast receivers that use intent filters, you must > explicitly declare the android:exported attribute for these app > components. Warning: If an activity, service, or broadcast receiver > uses intent filters and doesn't have an explicitly-declared value for > android:exported, your app can't be installed on a device that runs > Android 12 or higher. > > If the app component includes the LAUNCHER category, set > android:exported to true. In most other cases, set android:exported > to false. > > The following code snippet shows an example of a service that > contains an intent filter whose android:exported attribute is set to > false: > > <service android:name="com.example.app.backgroundService" > android:exported="false"> > <intent-filter> > <action android:name="com.example.app.START_BACKGROUND" /> > </intent-filter> > </service> The app worked fine in a quick test on an x86_64 AVD with API level 31. [1] https://github.com/material-components/material-components-android/releases/tag/1.5.0-alpha03 Change-Id: Ibb919e4edb995740e48ebc3338ffab6ca35c1373 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133167 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-04-14android: Use proper Intent to open doc for API level < 19Michael Weghorn
`Intent.ACTION_OPEN_DOCUMENT` was introduced in API level 19, therefore `Intent.ACTION_GET_CONTENT` is supposed to be used for older Android versions. The previous attempt at doing so didn't work, since no `ActivityNotFoundException` is thrown when trying to set the action to `Intent.ACTION_OPEN_DOCUMENT` on older Android versions. Fix that by using a proper version check instead. Change-Id: Ie06fa3f39e3042b4b7161a3c937bf655eb658abd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133025 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-04-14android: Use "ContentResolver#query" available from API level 1Michael Weghorn
Use the `ContentResolver#query` overload that is available from Android API level 1 on, not the one that's only available from API level 26 on [2], which would otherwise trigger an exception if run on devices running Android version < 8.0, as seen on an AVD with API level 21: > E/AndroidRuntime( 2914): FATAL EXCEPTION: main > E/AndroidRuntime( 2914): Process: org.libreoffice, PID: 2914 > E/AndroidRuntime( 2914): java.lang.NoSuchMethodError: No virtual method query(Landroid/net/Uri;[Ljava/lang/String;Landroid/os/Bundle;Landroid/os/CancellationSignal;)Landroid/database/Cursor; in class Landroid/content/ContentResolver; or its super classes (declaration of 'android.content.ContentResolver' appears in /system/framework/framework.jar) > E/AndroidRuntime( 2914): at org.libreoffice.ui.FileUtilities.retrieveDisplayNameForDocumentUri(FileUtilities.java:137) > E/AndroidRuntime( 2914): at org.libreoffice.ui.LibreOfficeUIActivity.createUI(LibreOfficeUIActivity.java:206) > E/AndroidRuntime( 2914): at org.libreoffice.ui.LibreOfficeUIActivity.onCreate(LibreOfficeUIActivity.java:147) > E/AndroidRuntime( 2914): at android.app.Activity.performCreate(Activity.java:5937) > E/AndroidRuntime( 2914): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105) > E/AndroidRuntime( 2914): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251) > E/AndroidRuntime( 2914): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360) > E/AndroidRuntime( 2914): at android.app.ActivityThread.access$800(ActivityThread.java:144) > E/AndroidRuntime( 2914): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278) > E/AndroidRuntime( 2914): at android.os.Handler.dispatchMessage(Handler.java:102) > E/AndroidRuntime( 2914): at android.os.Looper.loop(Looper.java:135) > E/AndroidRuntime( 2914): at android.app.ActivityThread.main(ActivityThread.java:5221) > E/AndroidRuntime( 2914): at java.lang.reflect.Method.invoke(Native Method) > E/AndroidRuntime( 2914): at java.lang.reflect.Method.invoke(Method.java:372) > E/AndroidRuntime( 2914): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899) > E/AndroidRuntime( 2914): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694) > [1] https://developer.android.com/reference/android/content/ContentResolver#query(android.net.Uri,%20java.lang.String[],%20java.lang.String,%20java.lang.String[],%20java.lang.String) [2] https://developer.android.com/reference/android/content/ContentResolver#query(android.net.Uri,%20java.lang.String[],%20android.os.Bundle,%20android.os.CancellationSignal) Change-Id: I13ecc57d3d6b25a7eb2e5ff85a3420ef8064cb20 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133024 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-04-14android: Port from Android Support Lib to AndroidXMichael Weghorn
Replace the no longer maintained Android Support Library with the Android Jetpack libraries. Quoting [1]: > Version 28.0.0 is the last release of the Support Library. There will be > no more android.support library releases. All new feature development > will be in the androidx namespace. Most porting was done automatically by using Android Studio's "Refactor" -> "Migrate to AndroidX..." function. In `android/source/res/layout/toolbar_bottom.xml` and `android/source/res/layout/toolbar_color_picker.xml`, the uses of `app:layout_behavior="android.support.design.widget.BottomSheetBehavior"` had to be replaced manually as described at [2], because the app would crash when using the old "android.support" values. Also drop the Android Support Library related bits from configure.ac In a quick test, this worked fine and no obvious difference was visible when running this in various AVDs. When trying to test this in an x86 AVD still using SDK 16 (Android 4.1), which is currently specified as Android Viewer's `minSdkVersion`, only various unrelated issues showed up, some of which will be handled in follow-up commits. After the migration, many weird errors showed up in Android Studio, which disappeared after invalidating the caches (via "File" -> "Invalidate Caches..."). [1] https://developer.android.com/jetpack/androidx [2] https://stackoverflow.com/questions/45100963/runtimeexception-could-not-inflate-behavior-subclass Change-Id: I2a57f0ebd56e7ecc09b7d65aae17fd15088a633b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133002 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-04-13android: Deduplicate LOKitThread#load{,New}DocumentMichael Weghorn
After Change-Id I15ecc2eba6c5ee441f6e14f8229594cab05dbba7 "tdf#148556 android: Don't delay refresh when loading doc", the only thing that `LOKitThread#loadNewDocument` does in addition to `LOKithThread#loadDocument` is to save the newly created document (to a temp file) if loading was successful. So, have `loadDocument` return a boolean saying whether loading was successful and call that method from `loadNewDocument` to reduce duplication. Change-Id: I9b99e011b3f5105bb60f95174de393462ff08271 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132966 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-04-13tdf#148556 android: Don't delay refresh when loading docMichael Weghorn
The previous way of using a separate Runnable to do the refresh and posting that to the main handler instead of doing the refresh right away resulted in a timing issue, due to which it could happen that a Calc document would not be rendered when initally loaded (but only after another tile reevaluation was triggered, e.g. by tapping on the screen). While this appears to happen mostly on fast hardware, I could reproduce on my AVD as well when increasing the minimum time that has to pass between tile reevaluations to 100 ms: --- a/android/source/src/java/org/mozilla/gecko/gfx/ComposedTileLayer.java +++ b/android/source/src/java/org/mozilla/gecko/gfx/ComposedTileLayer.java @@ -157,7 +157,7 @@ public abstract class ComposedTileLayer extends Layer implements ComponentCallba } long currentReevaluationNanoTime = System.nanoTime(); - if ((currentReevaluationNanoTime - reevaluationNanoTime) < 25 * 1000000) { + if ((currentReevaluationNanoTime - reevaluationNanoTime) < 100 * 1000000) { return; } For the bad case, the Runnable that triggers the refresh would be taken from the message queue and run on the main thread at a point in time that resulted in `LOKitShell.sendTileReevaluationRequest` not getting called in `ComposedTileLayer#reevaluateTiles` due to the above-mentioned minimum time in between tile reevaluations. Avoid the problem and simplify the whole handling by no longer posting a Runnable to the main handler, but calling `refresh()` right away. Posting to the main handler had been introduced in commit 27326e0f587c20d8dcf1595829233de1bd3fbe9e Date: Fri Aug 3 07:13:00 2018 -0700 tdf#119082 Exception wrong thread on Android Viewer to avoid crashes due to things being done on the wrong thread when switching to another app and then back to Android Viewer (s. tdf#119082), but that is no longer a problem, because the document is no longer loaded anew in that case since commit 1bc42472200c32c9a0a10dd1c3cd6c6a8a5d47d2 Date: Fri Apr 9 13:59:43 2021 +0200 tdf#95517 android: Rework app/doc lifecycle handling , so the code path is not used there any more, but only when the document is initially loaded, triggered in `LibreOfficeMainActivity#onCreate`. After all, the problem seems to be a similar one as fixed in commit 128f67e0efa02294205a1abe1be874557ecdcecd Date: Tue May 18 14:27:51 2021 +0200 tdf#142348 android: Avoid extra refresh after loading doc , where another timing issue in the handling of a refresh event could result in a blank page instead of the Calc doc being rendered. With the refresh being done right away, the synchronization added in commit 55661298bb3e9087a89a08637e4285f090c4e0e8 Date: Wed Apr 1 09:00:13 2020 +0200 tdf#131195 android: Don't destroy doc while loading it is also no more needed, because the situation described in its commit message no longer applies: > Since the 'refresh()' in 'LOKitThread::loadDocument' is > not executed synchronously but posted to the main handler, > this needs to be synchronized to prevent the document from > being deleted while it's being used. Change-Id: I15ecc2eba6c5ee441f6e14f8229594cab05dbba7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132965 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-04-11android: Drop leftover German translationMichael Weghorn
The English string had already been dropped in commit a23bd42e9b2f6401c710ac95afcc3aa8f360d65c Author: Michael Weghorn <m.weghorn@posteo.de> Date: Tue Apr 6 14:26:06 2021 +0200 android: Drop custom file abstraction + UI While the leftover German translation is just ignored in development builds, it resulted in an error when building a release APK like this: > ./gradlew assembleStrippedUIEditingRelease > warn: removing resource org.libreoffice:string/filter without required default value. > > > > Task :compileStrippedUIEditingReleaseJavaWithJavac > warning: [options] source value 6 is obsolete and will be removed in a future release > warning: [options] To suppress warnings about obsolete options, use -Xlint:-options. > Note: /home/michi/development/git/libreoffice-WORKTREE-for-android-x86/android/source/src/java/org/libreoffice/SettingsActivity.java uses or overrides a deprecated API. > Note: Recompile with -Xlint:deprecation for details. > Note: /home/michi/development/git/libreoffice-WORKTREE-for-android-x86/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java uses unchecked or unsafe operations. > Note: Recompile with -Xlint:unchecked for details. > 2 warnings > > > Task :lintVitalStrippedUIEditingRelease > /home/michi/development/git/libreoffice-WORKTREE-for-android-x86/android/source/res/values-de/strings.xml:28: Error: "filter" is translated here but not found in default locale [ExtraTranslation] > <string name="filter">Filtern nach</string> > ~~~~~~~~~~~~~ > > Explanation for issues of type "ExtraTranslation": > If a string appears in a specific language translation file, but there is > no corresponding string in the default locale, then this string is probably > unused. (It's technically possible that your application is only intended > to run in a specific locale, but it's still a good idea to provide a > fallback.) > > Note that these strings can lead to crashes if the string is looked up on > any locale not providing a translation, so it's important to clean them > up. > > 1 errors, 0 warnings > > > Task :lintVitalStrippedUIEditingRelease FAILED > > FAILURE: Build failed with an exception. Change-Id: I9a6c984d3250852d0e806cffdff81770ed868299 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132834 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-04-11android: Pass variable for "selected" paramMichael Weghorn
... of the CalcHeaderCell ctor, to simplify this a bit. Change-Id: I02ff00acccaec26de54534c6c021b9cd05f1d472 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132813 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-03-29android: Enable support for FODSMichael Weghorn
Enable support for MIME type "application/vnd.oasis.opendocument.spreadsheet-flat-xml" in AndroidManifest, the comment saying it crashes the app is obsolete. However, at least on my Android 10 AVD, that MIME type does not seem to be associated with '*.fods' files, so they were not offered to be opened. MIME type "application/octet-stream" was used instead, for which no support is declared. For testing, I just disabled the MIME type filter locally and was then able to open an FODS file just fine: --- a/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java +++ b/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java @@ -266,7 +266,7 @@ public class LibreOfficeUIActivity extends AppCompatActivity implements Settings } intent.setType("*/*"); - intent.putExtra(Intent.EXTRA_MIME_TYPES, SUPPORTED_MIME_TYPES);; + //intent.putExtra(Intent.EXTRA_MIME_TYPES, SUPPORTED_MIME_TYPES);; Change-Id: Ibf3f559a313f0b89bc4c25498e3efa0fcbded506 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132263 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2021-12-09Convert example document from cz to en-usJan-Marek Glogowski
Change-Id: Ia757491ce8802ec9deec9e75c65c6ae1c8ff2c79 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126460 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2021-10-22LOK: maintain blocked command list per viewPranam Lashkari
Conflicts: include/LibreOfficeKit/LibreOfficeKitEnums.h include/sfx2/viewsh.hxx libreofficekit/source/gtk/lokdocview.cxx sfx2/source/view/viewsh.cxx Change-Id: I7c621accd84f49447ab3e08a4bb662a9b91b834a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124049 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2021-09-03tdf#131548 Android: jump to cellIlhan Yesil
Added LOK_CALLBACK_SC_FOLLOW_JUMP: fire this signal to jump to cell cursor in android viewer. Payload format same as LOK_CALLBACK_INVALIDATE_TILES. Change-Id: Ic896baccf1327d6ccdf104811446e3454a42679e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116448 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2021-06-13tdf#142618 android: Don't crash when passed MIME type is nullMichael Weghorn
Change-Id: I5fb532b36fe650596f25a1ba8b7dc56e21292dc1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117053 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2021-05-21tdf#106893 android: Show whole doc when closing soft keyboardMichael Weghorn
When closing the software keyboard after typing, a black area instead of the doc content was shown in Android Viewer. This looks related to the fact that a SurfaceView is involved, s.a. [1] which suggests two potential solutions to fix the issue, but none of them really works well. (Setting a transparent background didn't have any effect when I tried. Using 'android:windowSoftInputMode="adjustPan"' in AndroidManifest.xml would work in general, but trigger the problem described in tdf#96789, namely the software keyboard would be shown on top of the document and the last part of the document would not be visible with the software keyboard enabled any more.) Rather, make sure an 'LOEvent.SIZE_CHANGED' is triggered when the software keyboard is enabled or disabled, in which case 'LayerView#onLayout' is called with a 'changed=true' parameter. To avoid resetting zoom and position of the document for this case, call the 'redraw' function with param 'false' when processing this type of event in 'LOKitThread#processEvent' (s.a. Change-Id: I8ba6a7cd8d984ad99654e188e00144e1edf407ed, "android: Don't reset zoom and position on refresh event" that did a similar thing for 'LOEvent.REFRESH'). This adds a 'force' boolean parameter to 'GeckoLayerClient#sendResizeEventIfNecessary', which interestingly had been there before commit 43bbf53bbad4623355e6344094573f8efca01df2 Date: Tue Jan 27 13:01:53 2015 +0900 android: remove unneded code from GeckoLayerClient but I didn't further check whether it had been used in any way that would have been useful for this scenario back then. Stackoverflow article [2] was quite helpful. [1] https://stackoverflow.com/questions/2978290/androids-edittext-is-hidden-when-the-virtual-keyboard-is-shown-and-a-surfacevie [2] https://stackoverflow.com/questions/52223095/how-to-detect-redraw-of-screen-has-completed-after-soft-keyboard-closes Change-Id: If3fdd1335468fc50901fc6c1982c1463c7804309 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115973 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2021-05-21android: Inline 'LayerView#setViewportSize' to only call siteMichael Weghorn
It doesn't override any parent class methods and was only called from here. Change-Id: Iccfacb42e8d5514994eafac841c0ec55be65b062 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115972 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2021-05-21android: Don't reset zoom and position on refresh eventMichael Weghorn
Don't call 'zoomAndRepositionTheDocument' for a REFRESH event. The only two places sending such an event are in 'LibreOfficeMainActivity#onStart' and in 'FormattingControler#sendInsertGraphic'. I don't see any need to reset the zoom and position in any of those two cases. Doing so had the effect that any manual zoom changes would be lost when e.g. switching between the LibreOffice Viewer app and another one, after a "Save As" or when inserting a picture. In my opinion, it's desirable to keep the view the user had before doing any of those actions and just rendering the document anew. To do so, add an extra bool parameter 'resetZoomAndPosition' to the relevant methods in 'LOKitThread' that says whether a reset should take place. Change-Id: I8ba6a7cd8d984ad99654e188e00144e1edf407ed Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115950 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2021-05-21tdf#106370 android: Make inserting pictures workMichael Weghorn
Instead of just setting LibreOfficeMainActivity's 'pendingInsertGraphic' member when inserting an image, call the method responsible for asking what compression to apply, doing the actual compression and sending the event so the picture is actually inserted right away. 'LibreOfficeMainActivity#pendingInsertGraphic' is (by now) only evaluated in 'LOKitTileProvider' when the document is initially loaded, therefore just setting it had no effect. The more complicated handling used previously instead of just inserting the picture right away was probably necessary/used because 'LibreOfficeMainActivity#onStart' used to reload the whole document before commit 1bc42472200c32c9a0a10dd1c3cd6c6a8a5d47d2 Author: Michael Weghorn <m.weghorn@posteo.de> Date: Fri Apr 9 13:59:43 2021 +0200 tdf#95517 android: Rework app/doc lifecycle handling and that was called when returning to the main activity from the picture chooser. (That is just a guess, I didn't actually verify this). While this fix probably doesn't have much to do with what caused that functionality to not work back in 2018, when most of the feature was introduced but it did not yet fully work as mentioned in commit 8d977511e3ab755da65d34a0bd618ef3c9db90c7 Date: Mon Aug 14 11:41:30 2017 -0500 tdf#106370 Android: add ability to insert pictures Added ability to insert pictures to Android Viewer. You can take photo or select photo from device or the cloud (Google photos, Dropbox). You can also compress the picture before inserting it with multiple compress grades. So far, inserting doesn't work for Writer due LO native library issues (I think). it still makes inserting pictures "just work" by now. Change-Id: Idad9dcbba177ea12f056bc31bd6b9c08621062cf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115932 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>