Wednesday, July 16, 2014

LibreOffice on Android

Thanks to Smoose, we are now able to do some real progress with the Android version of LibreOffice. The idea is to first build a LibreOffice document viewer, which is able to display any type of document that is supported by LibreOffice. Afterwards build on that and provide more features and eventually editing. The application itself should be a Android native application and use LibreOffice (interfacing through LibreOfficeKit) to provide tiles of a rendered documents and other needed pieces.

In the last couple of weeks I have been working on making this plan a reality. The first goal is to prepare the base of the application so I used the Fennec (Firefox for Android) source code. Fennec already solves many of the problems that we would need to solve - especially concerning drawing of tiles, touch handling, scrolling, tools and removed the rest, that will not be needed or needed later in development.

The calls to Gecko (rendering engine in Firefox) were replaced with our own implementation either in Java or a facade to LibreOfficeKit. By using a mock document tiles (tiles of the document that are part of the application's assets)  I was able to make the application work without actually interfacing with LibreOffice yet. With this the application  looked something like this:

At this stage the application was able to show a mock document with working scrolling and touch handling. The next big step was integration of LibreOffice and writing a JNI facade to LibreOfficeKit so that a real document rendered by LibreOffice could be show on a screen. With a big help from kendy we managed to integrate LibreOffice and correctly initialize LibreOfficeKit. After that the a real LibreOffice rendered document appeared:

See application in action video here.

Finally some results! There are some issues at the tile borders but this will be eventually resolved. The application uses OpenGL ES 2 for rendering so the user experience is smooth for the most parts (there are still things to optimize). This is the current state of the application but it is still far from complete however a lot of quite difficult technical challenges have been resolved and true development and polishing can now start.

Next steps are cleaning up and refactor a lot of code, integrate useful parts of previous attempt (LibreOffice4Android), tune tile loading and invalidation (when to load or remove which tile), making parts asynchronous to reduce blocking and improve the user experience, text selection and copy/paste, ...

I am really excited with what we have achieved and really looking forward to see where we go from here. By the time of LibreOffice 4.4 we should have a working and polished document viewer application ready. Thanks again to Smoose for funding for the work on this important step!

 Tomaž



6 comments:

  1. Finally! I'm really waiting for this. Great news!

    ReplyDelete
  2. Fantastic work! I am really looking forward to this!

    QUESTION: Why is development seemingly starting from scratch when you could use code from the Android port of OpenOffice which is open source?

    https://play.google.com/store/apps/details?id=com.andropenoffice&hl=en

    https://play.google.com/store/apps/details?id=at.tomtasche.reader&hl=en

    ReplyDelete
  3. AndrOpenOffice is NOT open source: it's a closed source app, because the Apache License v2 allows to create proprietary derivatives and don't share anything. It has been created by an independent developer and the source code isn't freely available, so AndrOpenOffice is a proprietary office suite.

    The app itself isn't an Android porting, just AOO 3.4.0 for Linux emulated over Xorg 7.7, which runs natively on Android. It’s a weird implementation, heavy and somehow unstable.

    LO4Android, instead, is a truly Android native and open source app :)

    ReplyDelete
  4. This is just what I need to be able to push LibreOffice on small business customers. Patiently looking forward to a full blown app with editing capabilities. My understanding has been then the people working on mobile LibreOffice have been doing so with a very small number of developers and very little time. I greatly appreciate your efforts. I generally donate to Open Source projects once or twice a month. In order to donate specifically for this project, should I go through donate.libreoffice.org with a mention that I want it to go to this project, or go through freedomsponsors.org? Thanks.

    ReplyDelete
    Replies
    1. Hi,
      Sorry for the late reply.

      This work was already sponsored but if you wish you can donate to the TDF (this is donate.libreoffice.com). This way everybody in the community has something from this - for example the infrastructure to work as comfortable as possible or to make things like the upcoming LibreOffice conference (https://conference.libreoffice.org/) possible. Thanks.

      Regards, Tomaž

      Delete