summaryrefslogtreecommitdiff
path: root/android
AgeCommit message (Collapse)Author
2021-04-12android: Drop some unused Turkish translationsMichael Weghorn
Those are leftovers; they're unused since commit a23bd42e9b2f6401c710ac95afcc3aa8f360d65c Date: Tue Apr 6 14:26:06 2021 +0200 android: Drop custom file abstraction + UI Change-Id: I898391cfccd465e4d18d51ee07ee847978872ef1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113885 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2021-04-12android: Drop 'LibreOfficeMainActivity#onSaveInstanceState'Michael Weghorn
It just calls the parent class method anyway. Change-Id: I802e75ad650b71d6daa08494ff812985bb844a5f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113884 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2021-04-12tdf#95517 android: Rework app/doc lifecycle handlingMichael Weghorn
Previously, the document was always closed in LibreOfficeMainActivity's 'onStop' and loaded anew in its 'onStart' method. In order to not lose user changes, there was also a caching mechanism in LOKitTileProvider, also triggered in 'LibreOfficeMainActivity#onStop'. This means that e.g. each time a switch to another Activity/app happened, a cache document with the user modifications in it should have been created for restoration. That did not really seem to work particularly well in a few tests, as also described in tdf#95517 ("changes reset after show Settings"). The documentation aboue Activity lifecycle says [1] > The entire lifetime of an activity happens between the first call to > onCreate(Bundle) through to a single final call to onDestroy(). An > activity will do all setup of "global" state in onCreate(), and release > all remaining resources in onDestroy(). For example, if it has a thread > running in the background to download data from the network, it may > create that thread in onCreate() and then stop the thread in > onDestroy(). This changes the handling to load the document in the 'onCreate' method and clos it only in 'onDestroy', i.e. the document remains open while e.g. switching to another Activity or app, thus making it unnecessary to try to restore state as good as possible in 'onStart'. An invalidation of the view (via 'LOEvent.REFRESH') generally seems to be enough. (Well, sometimes there is an issue with invalidation/repaint and single tiles remain black, but that happened previously - when the whole doc was loaded anew - just the same way). This allows dropping some extra handling needed to try to restore the previous state, along with the caching mechanism in LOKitTileProvider (that had some other issues, e.g. it didn't reliably create the cache file, since the file extension was not always set, and 'LOKitTileProvider#cacheDocument' was relying on that to derive the document type). I am not sure whether I missed any aspect that the previous implementation was trying to solve, but at least these scenarios I found and tested worked as expected with the change in place: * user changes still present after switching between apps (s. tdf#106648 "Android: save current work when onSaveInstanceState is called") * for the Calc case, the sheet that was selected before switching apps is still selected (s. tdf#101689 "Android Viewer calc returns to first sheet") * user changes no longer get lost when selecting a menu item (s. tdf#95517 "changes reset after show Settings") * case where the user leaves the app by pressing Home, and starts it again (as described in commit 83386129f5be002f2649db81bba4c468c7f6e4de "android: Fix the application lifecycle.") [1] https://developer.android.com/reference/android/app/Activity#activity-lifecycle Change-Id: If59734cbfd62673884786066c94e2c2a1d6a916e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113883 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2021-04-12android: Always create a temporary local copy of the docMichael Weghorn
Always create a local copy of the original document to work with, rather than doing a different handling depending on the type of the URI used to specify the file to load. This will also simplify adding support for "Save As" in upcoming commits, where the temporary file can remain the same and only the URI for the actual document will need to be changed. Change-Id: I2587611fa56b76d8a5384ac25c57335e8d12e987 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113882 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2021-04-12android: Turn 3 "internal" docs into raw resourcesMichael Weghorn
Make 'example.odt', 'license.txt' and 'notice.txt' (which can be opened via the "About" dialog) resources of the app by copying them to a new directory 'res_generated' instead of into assets, and include 'res_generated' into resources, then use an 'android.resource://' URI instead of a 'file:///assets/' one in AboutDialogFragment. The latter does not work with when passed as a parameter to 'ContentResolver.openInputStream'. Adapt/Simplify 'LibreOfficeMainActivity#copyFileToTemp' to make loading those docs using the 'android.resource://' URI work and use the existing 'copyStream' method for copying from the input to the output stream. This is in preparation for upcoming commit with Change-Id I7731ef81a4242fa0ce3b3fd8ced1683a6a6bee8c, "android: Always create a temporary local copy of the doc". Change-Id: I7731ef81a4242fa0ce3b3fd8ced1683a6a6bee8c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113881 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2021-04-12android: Drop fallback of opening default docMichael Weghorn
Drop the fallback of opening 'example.odt' when no file to open was given. I see no valid way how that fallback should be reached, so write an error log message instead, just in case there is still a way to get there. Change-Id: I8b8040ba0099cba9196f65982f09c67791be01c2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113880 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2021-04-12android: Extract method to copy streamMichael Weghorn
Extract method 'copyStream' used to copy the temporary file to the actual document URI when saving. It will also be used for copying the other way around when initially opening the document. Change-Id: I5382f4a7c49b454ff38fb8f95afab3c39145c11f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113879 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2021-04-12android: Add member for document URIMichael Weghorn
Add a 'mDocumentUri' member in LibreOfficeMainActivity to store the document URI rather than retrieving it from the Intent using 'getIntent().getData()' all the time. This is also in preparation to make it possible to change the URI later, e.g. when doing a "Save As". While at it, also switch to readonly mode for the fallback to 'DEFAULT_DOC_PATH' (though I don't think this should be relevant anyway). Change-Id: I629bad1d743e458191dcfa2b1371ea4b280e7b13 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113878 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2021-04-09android: Check result for CREATE_NEW_DOCUMENT IntentMichael Weghorn
Only try to retrieve the file URI and load the document if a file was actually selected. Change-Id: Icd47c197b67d593e74874e8136233b6e41a1a68d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113845 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2021-04-09android: Request PERMISSION_WRITE_EXTERNAL_STORAGE againMichael Weghorn
Requesting the permission on app start had been dropped in commit a23bd42e9b2f6401c710ac95afcc3aa8f360d65c Date: Tue Apr 6 14:26:06 2021 +0200 android: Drop custom file abstraction + UI Since the app now uses the Android Storage Access Framework [1] in order to open or create files from within the app, it not longer needs PERMISSION_WRITE_EXTERNAL_STORAGE for this. However, at least PDF export currently still directly writes to local storage ("Documents" directory), which fails without that permission being granted. In addition, opening files passed with a 'file://' URI in an 'Intent.ACTION_VIEW' also did not work anymore. I'm not sure whether this use case is particularly relevant in practice, though; at least all of the (few) apps I used during testing passed 'content://' URIs in their Intent. In addition, in Android 11 (API level 30) or higher, PERMISSION_WRITE_EXTERNAL_STORAGE no longer has any effect; from [2]: > More recent versions of Android rely more on a file's purpose than its > location for determining an app's ability to access, and write to, a > given file. In particular, if your app targets Android 11 (API level 30) > or higher, the WRITE_EXTERNAL_STORAGE permission doesn't have any > effect on your app's access to storage. This purpose-based storage > model improves user privacy because apps are given access only to > the areas of the device's file system that they actually use. > > Android 11 introduces the MANAGE_EXTERNAL_STORAGE permission, which > provides write access to files outside the app-specific directory and > MediaStore. To learn more about this permission, and why most apps don't > need to declare it to fulfill their use cases, see the guide on how to > manage all files [3] on a storage device. For now, request the permission again, at least as long as PDF export doesn't use the storage framework to ask where to save files. It certainly makes sense to reconsider this in the future (and decide to either drop the permission completely or request MANAGE_EXTERNAL_STORAGE for API level >=30). [1] https://developer.android.com/training/data-storage/shared/documents-files [2] https://developer.android.com/training/data-storage#permissions [3] https://developer.android.com/training/data-storage/manage-all-files Change-Id: Icc4c9c9b7b315d2a0b6a025439ae7e431cdd5b37 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113840 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2021-04-07Updated README.md files to represent current code / use Markdown formatHossein
Previously, all of the README files have been renamed to README.md and now, the contents of these files were changed to use Markdown format. Other than format inconsistency, some README.md files lacked information about modules, or were out of date. By using LibreOffice / OpenOffice wiki and other documentation websites, these files were updated. Now every README.md file has a title, and some description. The top-level README.md file is changed to add links to the modules. The result of processing the Markdown format README.md files can be seen at: https://docs.libreoffice.org/ Change-Id: Ic3b0c3c064a2498d6a435253b041df010cd7797a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113424 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
2021-04-07tdf#141338 android: Make "Select file to open" view smallerMichael Weghorn
Use the same height as is used for the "Recent files" entries. Change-Id: Ia6c1e02507ac12b554eb042d6dd32c0fc78cb578 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113675 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2021-04-07android: Move "Recent files" below system file picker viewMichael Weghorn
Move the view that opens the system file picker when tapped above the "Recent files" view in the Android Viewer start activity. Change-Id: I63ee0ea7fb784a3405877fcf5ed587ce06e8e093 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113674 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2021-04-07android: Drop custom file abstraction + UIMichael Weghorn
Android Viewer had its own file abstraction layer. From the (now deleted) IFile.java: > An abstraction of the File class, intended to be implemented by different > Document Providers. > > It represents a file or a directory in the context of a certain Document > Provider. It wraps the file-related operations and provides access to the > final document as a local File, downloading it if necessary. However, Android already provides such an abstraction by what is called "documents provider" there as well, s. [1]. Android Viewer has previously been adapted to support and make use of that. Therefore, drop the custom implementation to avoid duplication and having to reimplement functionality already provided otherwise. Also, drop the custom UI elements to display and select files implemented on top of the custom file abstraction. Support for using the system file picker (via the corresponding Intents) has been added earlier and is now the only available option to open files from within the app. [1] https://developer.android.com/training/data-storage/shared/documents-files Change-Id: Ide529e836a32fd7e880e5a72d971af9f9c7e74bf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113667 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2021-04-01android: Actually show recently used in "Recent files" listMichael Weghorn
Previously, a set was used to store the recently used files, meaning the order was lost when restoring from the prefs. Use a space-delimited string to store the entries in prefs instead, and convert that into an (ordered) list. This way, it's possible to always drop the oldest entry (instead of a random one) when inserting a new one and the max count has been reached, so the list of recently used files shows those that are actually the (up to 4) most recently used ones. Change the key used for the preference (variable 'RECENT_DOCUMENTS_KEY') to a different value, so there is no problem about trying to read old values stored as a Set<String> as a plain String. Change-Id: I95cc3627cd2975f0463f5ecb94292a26fe714066 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113462 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2021-04-01android: Show files opened using system picker for recently usedMichael Weghorn
Switch the list of recently used documents in LibreOffice Android Viewer to show the documents opened using the system file picker instead of those shown using the custom UI elements for file selection. This way, files provided by DocumentsProviders, like Nextcloud, can also be handled. As described at [1], this requires persisting permissions in order to be able to access the files after a device reboot. The corresponding method to do this, 'ContentResolver#takePersistableUriPermission', is only available from SDK level 19 on, so drop entries for older SDK levels (current minSdkVersion is 16). [1] https://developer.android.com/training/data-storage/shared/documents-files#persist-permissions Change-Id: Ifbf7148cda687a8a2e3f0c14fe66651509b2f19a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113459 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2021-04-01android: Drop check for SDK version < 16Michael Weghorn
This is unnecessary, since minSdkVersion was bumped to 16 in commit a7f6338875931d8afff55cb39ead8f6600af04cb Date: Wed Aug 7 12:06:25 2019 +0200 android: support NDK 19 and above (20 as of this commit) support for targeting API 14 and 15 was removed in NDK 18, so set minimum version to 16 [...] Change-Id: I70573f9e5e24b211ee7e84be5824d69e4f2b9f81 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113458 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2021-04-01android: Move code to get doc's display name from URI to static helperMichael Weghorn
Will be used in LibreOfficeUIActivity as well. Change-Id: Ie1b99f0d31dba1be263459d135ee7fcb36613a7b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113457 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2021-04-01android: Extract opening of file to separate method 'openDocument'Michael Weghorn
The method will also be used from elsewhere in a follow-up commit. Change-Id: I94cbdfa9faf54fcb655233f43d13ced8740b88a0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113456 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2021-03-31android: Don't mark doc changed on keypress in readonly modeMichael Weghorn
Since input etc. is otherwise ignored in readonly mode, also don't mark the document as changed on keypress. This e.g. avoids an unnecessary dialog whether or not to save the document after opening a document with experimental editing mode disabled, then pressing a key (on hardware keyboard, soft keyboard isn't shown in readonly mode) and then pressing the "Back" button to close the document again. Change-Id: I095c79549719d3760666605e1c642c58e6b1bb9d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113417 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2021-03-31android: Drop some unused importsMichael Weghorn
Change-Id: If72949f949cba23397d87c8f67b9434861f9bb7c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113414 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2021-03-31android: Don't require that user presses 'Back' twice to exitMichael Weghorn
Drop the "Press back again to quit" info shown when pressing "Back" in the file selection dialog in Android Viewer and just quit the app right away. It was originally added in commit d1f671e053864d0bf54d04a855761b43a7f5a9c4 Date: Wed Jun 10 19:04:22 2015 +0200 tdf#87434: android: system back key to go one level up Added an additional check so back has to be pressed twice on the root folder to actually leave the application. It's a check seen in many other apps. but I don't really see any need to bother the user about pressing "Back" again. Nothing is lost at this stage when quitting the app, and I haven't seen anything similar in many current apps myself (but have rather seen some extra confirmation dialogs disappear from desktop applications over the last years). The original request in tdf#87434 to go one level up in the directory hierarchy is unaffected by this, though this only applies for the custom widgets to browse the file system, which will potentially be dropped in the future anyway, now that support for the system file picker has been added in commit d678ee309b02b4cc8af29a097bf5053b8b1b4e06 Author: Michael Weghorn <m.weghorn@posteo.de> Date: Fri Mar 19 14:29:36 2021 +0100 tdf#129833 android: Allow opening files using system file picker Change-Id: Ib324b7f0b82427b04c7708665ff7492a758eec9b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113413 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2021-03-31android: Use system file picker to create new docsMichael Weghorn
Similar to the way that existing documents can be opened from within the Android Viewer app using the system file picker by using 'Intent.ACTION_OPEN_DOCUMENT', use the system file picker via 'Intent.ACTION_CREATE_DOCUMENT' to create new docs as well, instead of providing a custom dialog to insert a file name. As described at [1], this allows to save files in locations supported by any existing DocumentsProvider (e.g. a Nextcloud share, if the Nextcloud app is installed and set up), not just locally. This also allows to further unify the handling in LOMainActivity. Just like for the cases where an existing document is opened using the system file picker or a document is passed from a third-party app, the document URI is now set in the Intent, a temporary file is used and writing back to the actual URI happens on save. Drop LibreOfficeMainActivity's method 'showSaveStatusMessage', which was only meant to be used when a new file was created, but was called from the more generic 'LOKitTileProvider::saveDocumentAs'. Change that to show a more general error message when saving fails. Since the actual file is now created by the DocumentsProvider, LOKitTileProvider only operates on the temporary copy anyway. Side note: With this change in place, overwriting existing files also no longer just happens silently, as used to be the case when typing the name of an existing file in the custom dialog for creating new files earlier. Since 'Intent.ACTION_OPEN_DOCUMENT' was introduced in SDK version 19 (Android 4.4), restrict creating new docs to corresponding devices. [1] https://developer.android.com/training/data-storage/shared/documents-files Change-Id: I8932cb892ca8ac97a04d15cbd1540d0ee68350da Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113408 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2021-03-31android: Only update file path for "real Save As"Michael Weghorn
Follow-up for commit a1abf2c865228e6ed33e99ab73b94357ddbc590f (tdf#139350 android: Add param to allow a "real" "Save As"). The file path should only be updated when the newly saved doc is actually used (i.e. 'takeOwnership=true'), not when just saving a copy or exporting to a different file format. Change-Id: Ia3120a94b7fcc79c1a740a10bade8721f6771d78 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113404 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2021-03-31android: Drop unused 'newDocumentType' memberMichael Weghorn
It appears to have been unused since it was added in commit 78098b8494be7123bc4a8b50faa13445e5afd8ce Date: Mon Mar 27 22:26:47 2017 +0530 Add BottomSheetBehavior to formatting toolbar Change-Id: I43cc75e0b7a1bcebd01bd77fc7132a39510c70ba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113400 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2021-03-31tdf#139350 android: Fix handling of new docsMichael Weghorn
Pass param 'takeOwnership=true' to the 'saveDocumentAs' method when saving a newly created document in Android Viewer in 'LOKitThread::loadNewDocument', so the newly written document is used subsequently, rather than continuing to more or less operate on "private:factory/swriter" (for the Writer case, similar for the others). Extend 'LibreOfficeMainActivity::saveFileToOriginalSource' to handle this case as well (show a proper message and reset the modified state after saving). Drop now unnecessary special handling for the case of saving new files from the toolbar or the dialog shown when exiting without having saved previously. Change-Id: Ief95620e324aa2abc318f1add0b91376ffe669d6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113376 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2021-03-31tdf#139350 android: Add param to allow a "real" "Save As"Michael Weghorn
So far, LOKitTileProvider's 'saveDocumentAs' method was always saving a copy of the current document (or doing an export), but was not continuing to use the newly saved doc afterwards. Add an additional parameter 'takeOwnership' to the method to specify whether to do so. In other words, * the 'takeOwnership=false' case continues to do what was done previously, it basically does what "File" -> "Save a Copy" or "File" -> "Export" does in the desktop version * the 'takeOwnership=true' case now basically does the same as "File" -> "Save As" in the desktop version (except that the path is already known in the Android case) This essentially forwards the "TakeOwnership" param to LibreOfficeKit, which was originally added there in commit a121074cbd07939713e169586469b934aedbe594 Date: Wed Feb 10 13:26:50 2016 +0100 lok: Introduce a "TakeOwnership" filter option for saveAs(). It is consumed by the saveAs() itself, and when provided, the document identity changes to the provided pUrl - meaning that '.uno:ModifiedStatus' is triggered as with the "Save As..." in the UI. This mode must not be used when saving to PNG or PDF. Change-Id: I11b5aa814476a8dcab9eac5202bd052828ebbd96 This also adds a new 'SAVE_COPY_AS' event type to save a copy without taking ownership, and switches all uses of the 'SAVE_AS' event to that new one for now. (So the behavior remains unchanged, but the terminology is hopefully clearer.) Except for one instance in LOKitTileProver::saveDocument (where the cached version of the document is written to the original URI, if present), all other places are left with the previous behaviour in this commit. Further changes will be done in follow-up commits. Change-Id: I11996cd7276a6c6f2774535cd3e53cb997c8cd4e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113375 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2021-03-31android: TileKitProvider: Optionally detect file type from documentMichael Weghorn
Add an overload for the 'saveDocumentAs' method that takes just one parameter and auto-detects the file type to use from the document. Use it when creating new documents. Change-Id: I0f275ce159176292ffa1e52ed37673a486ab9428 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113374 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2021-03-24Using .md extension/Markdown syntax for modules READMEHossein
Renaming all README files for all top level modules to README.md, applying no content change at this stage to be able to track history of the files. These files should be edited to use correct Markdown syntax later. Change-Id: I542fa3f3d32072156f16eaad2211a397cc212665 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112977 Tested-by: Jenkins Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
2021-03-23Related tdf#129833 android: Drop android.permission.INTERNETMichael Weghorn
The permission was requested since ownCloud support was added in commit 69773f54bbac08953f0fbce16eecea0816e04338 ("Android: initial implementation of ownCloud provider.", 2015-01-21). Since the custom ownCloud support has been dropped in commit 6012599e17206ee7be9a83477654e7bd194079c3 ("tdf#129833 android: Drop non-working ownCloud/nextCloud support"), there should no longer be any need to require Internet access, so drop the permission again. Access to ownCloud and other Internet services providing file access now goes via DocumentProviders, and the corresponding apps providing those should take care of being allowed to access the internet by themselves. I tested that opening and editing a file located on a NextCloud share still works OK when the NextCloud app is installed and set up. Change-Id: Id8425e7afcd5ecc26d14ba9f42018f536d0a6a6e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112879 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2021-03-22tdf#141111 android: Don't crash trying to edit read-only sectionMichael Weghorn
Trying to type in a read-only Writer section in Android Viewer led to a crash due to '/assets//config/soffice.cfg/modules/swriter/ui/inforeadonlydialog.ui' not being present. Include the .ui file to avoid this. (Trying to type now doesn't do anything, no warning about this being read-only is shown.) Change-Id: I616d41c312187fa7855430715a47e80477ef2188 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112771 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2021-03-22tdf#129833 android: Move reading file to separate threadMichael Weghorn
Reading the input file from the main thread is problematic when that happens over the network. For example, trying to opening a file in a NextCloud share using the system file picker from within the LO Android Viewer app (with NextCloud app 3.15.1 serving as DocumentsProvider for the NextCloud share in the file chooser) previously resulted in a crash, with this in ADB log: I DownloadFileOperation: Download of /Documents/five_pages.odt to /storage/emulated/0/Android/media/com.nextcloud.client/nextcloud/<USERNAME>@demo2.nextcloud.com/Documents/five_pages.odt: Unexpected exception E DocumentsStorageProvider: RemoteOperationResult(mSuccess=false, mHttpCode=-1, mHttpPhrase=null, mException=android.os.NetworkOnMainThreadException, mCode=HOST_NOT_AVAILABLE, message=null, getLogMessage=Unexpected exception) Moving this to a separate thread fixes the NetworkOnMainThreadException and made opening, editing and saving the modified file back work successfully for that scenario. (Using a separate thread when writing back does not seem to be necessary, but could be added in a similar way.) This just moves the IO to a new thread and then waits for its completion. For a better user experience in cases where the copy operation may be slow, providing some additional feedback in the UI might be useful. Change-Id: I58e2c4bb1dcd2d59383fba0f216c9614f5d3e3a7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112769 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2021-03-22tdf#129833 android: Allow opening files using system file pickerMichael Weghorn
Extend Android Viewer with the possibility to select a file to open using the "system file picker", which can be opened by an Intent that has the action 'Intent.ACTION_OPEN_DOCUMENT' (or 'Intent.ACTION_GET_CONTENT' for API level < 19) set. This way, all locations supported by currently installed and set up DocumentsProviders [1] are generally supported. In a test, opening local files worked just fine, but trying to open a file located in a NextCloud share failed (with the corresponding app [2] installed), showing this in ADB log: I DownloadFileOperation: Download of /Documents/five_pages.odt to /storage/emulated/0/Android/media/com.nextcloud.client/nextcloud/<USERNAME>@demo2.nextcloud.com/Documents/five_pages.odt: Unexpected exception E DocumentsStorageProvider: RemoteOperationResult(mSuccess=false, mHttpCode=-1, mHttpPhrase=null, mException=android.os.NetworkOnMainThreadException, mCode=HOST_NOT_AVAILABLE, message=null, getLogMessage=Unexpected exception) This will be dealt with in a separate commit. For now, this way to open files (and a corresponding menu entry) is added in addition to the existing ones, but since that method should in general be able to cover all of the other use cases as well, the other options may be dropped in the future. [1] https://developer.android.com/reference/android/provider/DocumentsProvider [2] https://github.com/nextcloud/android Change-Id: I684a4aa770c0df7cc9fc35ff92445230405885f5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112768 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2021-03-22tdf#129833 android: Allow editing writable docs passed by IntentMichael Weghorn
When a document is passed by an Intent in Android Viewer, allow editing if the Intent has flag 'Intent.FLAG_GRANT_WRITE_URI_PERMISSION' set. Since LibreOffice operates on a temporary copy in this case, write the content of the temporary file back to the original URI when saving. This in particular allows editing documents passed from third-party apps, e.g. opened from Android's "Files" app or the NextCloud app. The online-based Android app already does something similar. Change-Id: Icf252a95dd9a8089ca8610ccf3edfbeee2682e1a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112767 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2021-03-22tdf#129833 android: Drop non-working ownCloud/nextCloud supportMichael Weghorn
As mentioned in tdf#129833 comment 3, the idea is to use Android's "system file dialog" to select files rather than maintain a separate ownCloud/nextCloud connector in the Android Viewer app. This way, everything for which a DocumentsProvider [1] is available will be available from within the app, once Android Viewer has been adapted to support those, which is planned for a subsequent step. Corresponding DocumentsProviders for ownCloud [2] and nextCloud [3] exist. [1] https://developer.android.com/reference/android/provider/DocumentsProvider [2] https://github.com/owncloud/android [3] https://github.com/nextcloud/android Change-Id: I6581ce36672f582f91d47598afdfd32c3a4a58da Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112765 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2021-03-19android: Update obj path in READMEMichael Weghorn
... according to the changes done in commit 0dffc65236fbacf98047d6dbfc82b4efe7dd959b Date: Fri Jun 5 08:59:26 2020 -0400 android: fix the build output directory When compiling in a different build output directory, the "liblo-native-code.so" file is created in the source directory and it fails compiling the "online" project Change-Id: I886231034bbe3937748d9b5ef56239aea3cf7b8c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112702 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2021-03-19android: Don't allow editing for read-only docsMichael Weghorn
Previously when experimental mode was enabled in Android Viewer, a "This file is read-only, saving is disabled." info was shown to the user when opening a file read-only, e.g. when the file was passed from a third-party app. However, editing the document was still possible, a dialog asking whether or not to save the modified doc was shown when existing and only then saving would fail. Disable editing completely for this case, rather than having the user lose changes in the end. Change-Id: Ie523971949d11909223aeac4f99023ecf28cb56c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112693 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2021-03-19android: Don't show message for readonly files in non-experimental modeMichael Weghorn
Since editing is disabled in Android Viewer for non-experimental mode anyway, there's no need to tell the user it's not possible to edit a specific document if it's readonly. Replace the 'usesTemporaryFile' method with a more explicit 'isReadOnlyMode' method since ToolbarController shouldn't have to worry about implementation details like whether temporary files are used and the new method will be reused in other places in a follow-up commit as well. Change-Id: Iaccf5b40bd19887b9e76b982ce7252368871c716 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112692 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2021-03-18tdf#125318 android: Allow copying with editing disabledMichael Weghorn
Don't make the possibility to select and copy text depending on editing being enabled, i.e. experimental mode being enabled in Android Viewer. In a quick test, this worked just fine in read-only mode as well, so tapping on text in a document now shows two cursors around the tapped word, and allows adapting the selection using these and copying to the clipboard by using the corresponding toolbar entry. Change-Id: Icbd9d055a6cc700b78711df178f594c7a9c5cfbf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112673 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2021-03-18android: Show original instead of temp file nameMichael Weghorn
When a temporary file is created in Android Viewer (e.g. when a file is passed from another app, like a file explorer or an email app), still show the original file name in the toolbar, instead of the name of the temporary file (like "LibreOffice1588848072959345750.tmp"). Change-Id: I86f5cebfa8e2986fe812ace16c0df324d1420955 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112643 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2021-03-16tdf#141052 android: Include 'tabbuttons.ui' and 'tabviewbar.ui'Michael Weghorn
... which have been added in commit e00fd78e6e454491014f03370e14efa5ebc2eefe Date: Thu Oct 22 19:41:17 2020 +0100 weld impress TabBarControl and commit aa0657e2983007c505b1223281df4a3a4eb6e73a Date: Fri Nov 20 15:59:17 2020 +0000 weld ImplTabButtons and are now needed by Impress in Android Viewer as well. Change-Id: I7fd89fa78a277d9da2121a47765107166ada1fd3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112557 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2021-03-15tdf#141044 android: Update included .ui filesMichael Weghorn
... according to changes in commit 51379fb3d46e5891bdaea0122bd62b0753663da3 Date: Thu Dec 3 15:54:45 2020 +0000 weld writer's FrameControl MenuButtons and commit a39a3f1ad1e5e39b09ce474c0f4c0f9f4e174bbe Date: Tue Feb 9 12:07:27 2021 +0000 weld impress annotation window Change-Id: I635a6ce74844d08cafa8c50c090ba04b2aefc287 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112490 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2021-01-09Fixed few grammar mistakesViKrAm-Baisclear
Change-Id: I772d24df6aefc441380379c2a2f075e879aafa29 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108936 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2020-11-19Make sure $(SODEST)/libc++_shared.so target dir existsStephan Bergmann
...similar to how this is done for the other $(SODEST)/... targets above (and which has presumably been missing accidentally from eb050ae015300e850553f71b4ebbd80f40f4c3f3 "tdf#123290 fix android tinderbox builds/properly package libc++_shared.so". Saw <https://ci.libreoffice.org/job/gerrit_android_x86/830/> fail once with > cp: cannot create regular file ‘/home/tdf/lode/jenkins/workspace/android_x86/android/jniLibs/x86/libc++_shared.so’: No such file or directory > ../Bootstrap/Makefile.shared:75: recipe for target '/home/tdf/lode/jenkins/workspace/android_x86/android/jniLibs/x86/libc++_shared.so' failed > make[2]: *** [/home/tdf/lode/jenkins/workspace/android_x86/android/jniLibs/x86/libc++_shared.so] Error 1 > make[2]: *** Waiting for unfinished jobs.... > /home/tdf/lode/jenkins/workspace/android_x86/android/CustomTarget_lo_android.mk:17: recipe for target '/home/tdf/lode/jenkins/workspace/android_x86/workdir/CustomTarget/android/source/done' failed > make[1]: *** [/home/tdf/lode/jenkins/workspace/android_x86/workdir/CustomTarget/android/source/done] Error 2 Change-Id: Ief6b6274ad789d441c2692b941ba0aa8df276e40 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106119 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-09-30android: "make run" works also for debug configurationVasily Melenchuk
In debug mode Android package name is "org.example.libreoffice" and "make run" said that there is no such intent to launch. Change-Id: I6d8eac85dedf3e387a9dd4a228605f79ca0d5aee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103287 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2020-08-19Remove BuildVersion also from Android and iOS version ini filesStephan Bergmann
...after 5fdf2009d21fa220dfee70ea755bd698c16257a7 "tdf#134522 remove --with-build-version ./configure flag", 00fa759dc9f13eb4618a7762be9ca6eaf3fd37f7 "tdf#135133: Don't try to read BuildVersion", and 6ee46adb446f5350df2b1efc7fc3ffe2506dfaa0 "Remove BuildVersion from installation set version ini files" already removed it from anywhere else Change-Id: I42ccf35d6952ad0a826517ecadfe0ebb3bb704a0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101003 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-07-17Update paths in Makefile.in and android/.gitignoreMichael Weghorn
commit 0dffc65236fbacf98047d6dbfc82b4efe7dd959b Date: Fri Jun 5 08:59:26 2020 -0400 android: fix the build output directory had changed the output directory, so adapt the paths in .gitignore and Makefile.in accordingly. Change-Id: I9c145e359e20167185ae2f7b055fa3b1dac870f8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98971 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2020-07-17tdf#134846 Android Viewer: Include native libs againMichael Weghorn
commit 0dffc65236fbacf98047d6dbfc82b4efe7dd959b Date: Fri Jun 5 08:59:26 2020 -0400 android: fix the build output directory submitted on 2020-07-07 had changed the output directory for native libraries, so the directory used by Android Viewer was empty, and native libs no longer contained in the package/APK. Store the actual/new directory in a variable and use that one in build.gradle to make things work again. Change-Id: I5a051342278ab14e71edf47dd93e8dacdb9f3cb6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98970 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2020-07-07android: fix the build output directoryHenry Castro
When compiling in a different build output directory, the "liblo-native-code.so" file is created in the source directory and it fails compiling the "online" project Change-Id: I4782a69796fb298e9c1a6c4370720b18587735e9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95602 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Henry Castro <hcastro@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98290 Tested-by: Jenkins
2020-07-01tdf#134405 android: Add null checkMichael Weghorn
Without it, Android Viewer crashes in experimental editing mode when e.g. opening the sample doc and clicking into the text area. E AndroidRuntime: FATAL EXCEPTION: main E AndroidRuntime: Process: org.libreoffice, PID: 6152 E AndroidRuntime: java.lang.NullPointerException: Attempt to read from field 'float android.graphics.RectF.left' on a null object reference E AndroidRuntime: at org.mozilla.gecko.gfx.RectUtils.scale(RectUtils.java:45) E AndroidRuntime: at org.libreoffice.overlay.DocumentOverlayView.convertToScreen(DocumentOverlayView.java:194) E AndroidRuntime: at org.libreoffice.overlay.DocumentOverlayView.repositionWithViewport(DocumentOverlayView.java:184) E AndroidRuntime: at org.libreoffice.overlay.DocumentOverlayView.changeGraphicSelection(DocumentOverlayView.java:157) E AndroidRuntime: at org.libreoffice.overlay.DocumentOverlay$11.run(DocumentOverlay.java:199) E AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:883) E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:100) E AndroidRuntime: at android.os.Looper.loop(Looper.java:214) E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:7356) E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930) Change-Id: Ibff148a5d83413b4eed8a054b0143c9dae4e5537 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97632 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>