Commit Graph

71 Commits

Author SHA1 Message Date
5f89da97dc Removed static context from LOKitThread
Moved LOKitThread back to LibreOfficeMainActivity, so that it could
use the context in the constructor. Once the Context became available
in LOKitThread, it was simply a matter of replacing static references
with the one passed in the constructor.

Also changed access levels of some methods in LOKitThread.

Change-Id: I0cc2c846c67b90907cbf3dce363666f9ab02d887
Reviewed-on: https://gerrit.libreoffice.org/33546
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
Tested-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
2017-01-31 10:58:01 +00:00
d339bba78a Removed static context from JavaPanZoomController
Removed static context, and edited the access levels of some methods
in the classes, along with some general code style fixes.

Change-Id: I89c71fa38eaafb5cda721602cfc8dad10ba7d26a
Reviewed-on: https://gerrit.libreoffice.org/33557
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
Tested-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
2017-01-31 10:53:36 +00:00
644d92ada4 Removed static context from LOKitTileProvider
Removed references to static context, replaced them with the context
object already available in the class, and changed access levels on
some methods in LOKitTileProvider.

Change-Id: Ib52d325650377b77ec166ddbfb760f74c19067ff
Reviewed-on: https://gerrit.libreoffice.org/33554
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
2017-01-31 10:47:42 +00:00
8802ebd517 Moved About dialog to DialogFragment
This makes the dialog more modular, and it takes no parameters
instead of two. This is in the preparation of making
the classes more independent on each-other's states, which is very
important. Also, this follows the Android way of workflow better,
since there is no "wrapper" class around the dialog, but instead
the dialog is called directly.

Change-Id: I7571480a040efaf202fae3929cfe76d65c19653e
Reviewed-on: https://gerrit.libreoffice.org/33086
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Aleksandar Stefanović <theonewithideas@gmail.com>
2017-01-26 12:22:14 +00:00
6310fa8a70 Replaced empty spinner with the document title
Replaced empty spinner with the document title in the Main (viewer)
activity. Had to edit the themes to not disable title, and edit the
manifest to make the desired activities use that theme. If the theme
is set in the "application" tag, it will apply the theme globablly.
Also cleaned up and tightened the ToolbarController.

Change-Id: I5099860787b5f84d01c98c5e53ade519c2f89cc4
Reviewed-on: https://gerrit.libreoffice.org/33306
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Aleksandar Stefanović <theonewithideas@gmail.com>
2017-01-25 12:56:26 +00:00
96b2aa3f82 Reduce usage of memory-leaking Context object
Huge refactoring of the methods to use the passed instance of the
Context object instead of using the static one. I couldn't completely
remove the static object, because it requires restructuring of the
workflow so that it originates from the activity, and not from some
other random place. The way it was refactored is:

1. Find a place where the static object
(LibreOfficeMainActivity.mAppContext) is used.
2. Add a LibreOfficeMainActivity object to the method signature.
3. Repeat the process with a method that calls it, and repeat until
the LibreOfficeMainActivity object isn't available, so that it can be
passed through all the methods, to the place where the static object
was used.
4. Replace that static object with the parameter of the function.

The commit looks pretty huge, but it's basically just the simple
refactoring explained above. The memory leak isn't completely gone,
but this a progress towards it. Also moved the "global" objects of
Handler and LOKitThread from an Activity to an Application, which
is the correct place for "global" variables. Can someone explain why
Handler and LOKitThread are used? They seem to mostly do nothing, but
steeply increasing the complexity of the application.

Change-Id: Ib2be77fa3adea94d6b7849d0e2afa90bf318d68b
Reviewed-on: https://gerrit.libreoffice.org/33073
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Aleksandar Stefanović <theonewithideas@gmail.com>
2017-01-25 09:16:51 +00:00
9123ba9632 Cleaned up FormattingController
It was coded pretty badly, so I cleaned it up. Most notably, it used
a static instance of the Activity, which is a huge no-no which
creates memory leaks. The irony is, it already had a reference to the
Activity used correctly in the constructor. One memory-leak fixed,
29 more to go (LibreOfficeMainActivity holds that static Activity
object which needs fixing). Also, simplified the "bottom toolbar"
in preparation for the CoordinatorLayout implementation which will
allow the activity to have fancy animations and smart interactions.

Change-Id: I31aa117f6179910db73a5256b0a287357e1dec83
Reviewed-on: https://gerrit.libreoffice.org/33010
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: jan iversen <jani@documentfoundation.org>
2017-01-16 08:05:25 +00:00
15c97b28aa Fixed typo in SearchController
Fixed typo in SearchController (SearchDriection -> SearchDirection)
Also tightened up the code.

Change-Id: Iedb6f95c9d8ed04cc166638250c2d565e92d79ff
Reviewed-on: https://gerrit.libreoffice.org/33011
Reviewed-by: jan iversen <jani@documentfoundation.org>
Tested-by: jan iversen <jani@documentfoundation.org>
2017-01-16 08:04:15 +00:00
a2945d837b Replaced list and grid with RecyclerView
Because RecyclerView is more optimized, especially if there are lot
of items. This way, we don't have to recreate ListView and GridView
each time we switch view modes. Changed list adapter to appropriate
RecyclerView adapter, and created new grid adapter inline, next to
the list adapter, while deleting the older grid adapter file. Since
these adapters are almost identical in content, maybe we could:
a) Make them extend the same "base" adapter, to avoid duplicate code
b) Unite them into one adapter which would display appropriate views
at appropriate times.

Change-Id: I1545c2c245ca642a689dee584bffb15f90aac4a6
Reviewed-on: https://gerrit.libreoffice.org/32976
Reviewed-by: jan iversen <jani@documentfoundation.org>
Tested-by: jan iversen <jani@documentfoundation.org>
2017-01-16 08:03:42 +00:00
b610c98b59 Revamped the navigation drawer
Replaced the custom implementation of the drawer with the support library one.
This one inherently follows Material Design guidelines, and is much easier to
maintain. This implementation also allows for header in the drawer, and so
we could put something useful there to make the drawer even better. Also kept
the original way of programatically adding the menu items, although I find this
practice somewhat unelegant. Maybe we could have static list of items, and then
grey-out the ones that aren't currently available? Also added appropriate icons
to the menu items (which are vector drawables, of course), but I only covered
the providers that appeared on my device (I can't confirm that there are no
other providers), so if the provider is covered, it will have an icon, but if
I didn't cover it, it will appear just fine, but without an icon. Maybe we
could move the settings and sorting to the navigation drawer, also? It would
be cleaner and more elegant, IMO.

Change-Id: I02a051f0b75c6d4e16f518aa19fb9c6eef00f5e4
Reviewed-on: https://gerrit.libreoffice.org/32881
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: jan iversen <jani@documentfoundation.org>
2017-01-16 08:02:17 +00:00
2e582ed403 tdf#101689 - Fix returning to first part of documents when resumed
Change-Id: I6d3a9354c702628e991c69176086efbbc28ddd74
Reviewed-on: https://gerrit.libreoffice.org/31753
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: jan iversen <jani@documentfoundation.org>
2017-01-13 09:59:54 +00:00
a940c8280d Folder icon redesign
Replaced old and busted icon design, with Google's generic app icon.
It is now a vector drawable, which means it will be sharp at any resolution,
while we only need to keep one tiny xml file for it. No folder thumbnail
support, but this a welcomed change nontheless.

Change-Id: Ie6e38a6ac8e6cf1bc2d22247c11b5de0bd0d8478
Reviewed-on: https://gerrit.libreoffice.org/32498
Reviewed-by: jan iversen <jani@documentfoundation.org>
Tested-by: jan iversen <jani@documentfoundation.org>
2017-01-11 07:00:51 +00:00
d976f9151a Updated toolbar spinner to newer implementation
Lowered all-caps navigation labels to something more professional.
Added a Spinner to the Toolbar in XML.
Reworked many lines of LibreOfficeUIActivity to remove possible NPE's, and also
removed redundant lines, which were mostly deprecated, as well as switching to
a newer implementation of a toolbar-spinner navigation pattern. There are more
deprecated methods, but I wanted them in a separate commit.

Change-Id: I15d5365ed7c00880873bf7874bc794008436bb99
Reviewed-on: https://gerrit.libreoffice.org/32497
Reviewed-by: jan iversen <jani@documentfoundation.org>
Tested-by: jan iversen <jani@documentfoundation.org>
2017-01-11 06:54:10 +00:00
11e443bfe1 Removed unnecessary imports
Import redundancy reported by Android Studio.

Change-Id: If46a43bb18268877d41d4957094acc543c4588fd
Reviewed-on: https://gerrit.libreoffice.org/32496
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: jan iversen <jani@documentfoundation.org>
2017-01-11 06:53:14 +00:00
45f75e2909 tdf#104856 - Fix for closing the document without asking for saving
Change-Id: I37b6fbf2639439a57c6d162b7817d009d1d49023
Reviewed-on: https://gerrit.libreoffice.org/32332
Reviewed-by: jan iversen <jani@documentfoundation.org>
Tested-by: jan iversen <jani@documentfoundation.org>
2016-12-24 08:24:42 +00:00
252008d492 tdf#103524 - Fix Bottom Toolbars closing operation
Added variables to control state of bottom toolbars, and based
on their state open/close the bars

Change-Id: I5f9429b336451a354b95dcee18b71fb577c28559
Reviewed-on: https://gerrit.libreoffice.org/30298
Reviewed-by: jan iversen <jani@documentfoundation.org>
Tested-by: jan iversen <jani@documentfoundation.org>
2016-12-06 08:31:00 +00:00
7d794b193e tdf#96797 - Android: Viewer file filter is not working on ownCloud
Change-Id: I6ffb450d935ae1f7b4900243b9ff2f8df408628f
Reviewed-on: https://gerrit.libreoffice.org/27829
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: jan iversen <jani@documentfoundation.org>
2016-09-19 06:14:52 +00:00
c57e7685f2 tdf#101260 - Android: Filter in External SD doesn't work
Change-Id: Iaba74749c11cbac972fecf816e5bb090edd9e06c
Reviewed-on: https://gerrit.libreoffice.org/27802
Reviewed-by: jan iversen <jani@documentfoundation.org>
Tested-by: jan iversen <jani@documentfoundation.org>
2016-09-19 06:12:18 +00:00
fbda3f9a8d tdf#96810 - Fix Android Viewer: Keyboard can not hide with keyboard button.
Change-Id: I87d83953094d31ed4e1bcf60c55dd19056a7994e
Reviewed-on: https://gerrit.libreoffice.org/28005
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: jan iversen <jani@documentfoundation.org>
2016-09-09 08:16:55 +00:00
5bdea25f68 tdf#96771 - bug fix for owncloudfiles with white space characters
Change-Id: I373db55ed819ed5d2a574ba2590032ee628218f4
Reviewed-on: https://gerrit.libreoffice.org/27634
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Reviewed-by: jan iversen <jani@documentfoundation.org>
Tested-by: jan iversen <jani@documentfoundation.org>
2016-08-28 07:13:01 +00:00
428e23f4f7 Fix some spelling errors in comments and strings
Change-Id: Iecd6b5e13d6be14651f77d8e37f01117ba15a11e
Reviewed-on: https://gerrit.libreoffice.org/26883
Reviewed-by: jan iversen <jani@documentfoundation.org>
Tested-by: jan iversen <jani@documentfoundation.org>
2016-07-04 06:11:36 +00:00
66be4feef7 android: prevent crash if storage is unavailable
Change-Id: I350acc1735d5fd22a27434fc5ccf2ab39bf3d2cf
2016-07-02 17:20:52 +02:00
c6e8c96d50 tdf#99539 - fıx crash on android 5.1
Change-Id: I3d484f7d7d9e466ae1b2ac4afe2b59d060fa8b77
Reviewed-on: https://gerrit.libreoffice.org/24537
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2016-05-01 10:10:12 +00:00
fc2590cfa1 Fix typos
Change-Id: Id81b16ff26283611f0b84929d831c827f847ab73
Reviewed-on: https://gerrit.libreoffice.org/24317
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
2016-04-30 15:06:45 +00:00
c9c78dc1a5 formatting and whitespace
Change-Id: Icc086404a2ef32a38e972da9158f6156fdf74ef2
Reviewed-on: https://gerrit.libreoffice.org/23363
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
2016-03-19 17:33:31 +00:00
956d48b5a5 android: document some parameters for doxygen
Change-Id: I4382949a35df3877fc6c93a83d6e84cd892756a8
2016-02-05 23:03:01 +11:00
1dfb68debb tdf#88389 - android document browser: external storage access
Background:
External SD cards are only partially supported by the Android system,
with a great deal of fragmentation on implementation across manufacturers
and android versions. There is no official support for OTG devices.

This commit adds:
1) External SD card support
2) OTG device support

Caveats:
1) Not tested on Android 6. Emulator crashes when opening
files on Android 6, using an unmodified build of the master branch.

2) OTG support currently works only if there is write access
to the OTG directory. The user must be aware of exact OTG directory
path or be able to navigate to it as well.

3) External SD card provider currently lacks file filtering.

Approach:
-----
Added new document providers.

External SD cards:
There are 2 different document providers external sd cards,
one for Android 4.4 and above, and the other for older versions.

1) New
Android 4.4 and above require usage of the DocumentFile wrapper class
to access files in external storage. Actual file paths are no longer
obtainable. As such, the underlying file will be cloned in a cache,
allowing us to get an actual file path and use LOK.
Some differences exist between 4.4 & 5+. The document provider handles
each case separately.

2) Legacy
Android 4.3 and below do not support the DocumentFile wrapper.
File object can be used in these versions, allowing actual file paths
to be obtained. The document provider guesses the root directory of
the SD card. If the guessing fails, the user is to navigate to
this directory himself.

OTG:
The OTG document provider resembles the legacy external SD card
document provider, requiring the user to locate the directory himself.
The document provider does not guess the root directory of the OTG
device as the location varies with manufacturer implementation.
-----

Supplementary Notes:
Attempting to use the internal app cache as the file cache like in
the ownCloud document provider did not work. Using the external app
cache works fine though. It could be because initializing LOK wipes
the internal app cache.

Would be good to test the ownCloud document provider to confirm if it
works.

Change-Id: Ie727cca265107bc49ca7e7b57130470f7fc52e06
Reviewed-on: https://gerrit.libreoffice.org/20738
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
2016-02-02 19:25:41 +00:00
64d624b651 Fix typos
Change-Id: I9a5940027423ff0791fa7da0b79b617412ce6b86
Reviewed-on: https://gerrit.libreoffice.org/21209
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-10 14:17:20 +00:00
fbec6ac089 Fix typos
Change-Id: I3fba2c76c83381eb398c80947ef4849bccf7ab27
Reviewed-on: https://gerrit.libreoffice.org/21078
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-05 13:40:54 +00:00
321dc29fc5 tdf#88391 android document browser: draw and impress icon is the same
Added missing code to set icon for draw in grid mode.

Change-Id: I9ee356d5ab1a296a90e5ece11f5f4c50e7600f13
Reviewed-on: https://gerrit.libreoffice.org/19921
Reviewed-by: jan iversen <jani@documentfoundation.org>
Tested-by: jan iversen <jani@documentfoundation.org>
Tested-by: Jenkins <ci@libreoffice.org>
2015-12-25 12:59:10 +00:00
6f5589d5ed android: another part where underline and strikethrough commands were swapped
Change-Id: I8fdde4b46e3e315a5b6a35cabc4495ebf69db057
2015-11-21 14:54:43 +01:00
9feffdbe0d android: underline and strikethrough commands were swapped
Change-Id: Id7157ea5fadd684dceec52f69ec9279c4107b5f1
2015-11-21 10:51:40 +01:00
506432f505 android: don't crash on empty filelist
Change-Id: I46caceed3fdf0ad0aa51c8a8ede1177ca3d1855e
2015-11-17 14:54:32 +00:00
d30e0aea02 android: rename "editMode" to "experimentalMode"
Change-Id: I3fcb7bb2fda925a1c5b2633ac7f6846fda0dabf8
2015-11-13 11:40:34 +01:00
8908920488 android: add undo/redo to the main toolbar
Change-Id: I64f76d22018fcd8af2991933ba5ab2069f84181f
2015-11-13 11:40:34 +01:00
6636476cf0 android: Add string searching + search toolbar
LOKit supports searching, but this was not implemented yet in the
Android GUI. This adds a bottom search toolbar where you can type
a search string + up/down search handles to search for the string
from the current cursor position.

Change-Id: Ia7461d2c6399c23201d2ea81f0b44c38533939a1
2015-11-13 11:40:33 +01:00
319623a334 android: Add bottom formatting toolbar
The bottom formatting toolbar now shows the formatting options
previously located in the main toolbar as a menu entry (bold,
italic, ...). In addition alignment options and selection of fonts
and sizes have been added.

Bottom formatting toolbar is not shown by default - it enables when
hitting the icon in main toolbar. Also soft keyboard and formatting
toolbar should not be shown at the same time.

Change-Id: I5f6cf8a9fcbdb4d154ae7504a65f9a226c99d694
2015-11-13 11:40:33 +01:00
96cd2abd74 LOK: setClientZoom() - sets the client zoom level
We need to know the client's view level to correctly handle the mouse
events in calc. PaintTile() set a zoom level that corresponds to the
requested tiles and previously postMouseEvent would call SetZoom(1,1).
Now we can make use of knowing the client's view level and call
SetZoom() with the correct parameters

Change-Id: I34b5afcdcc06a671a8ac92c03e87404e42adf4cd

Conflicts:
	sc/source/ui/unoobj/docuno.cxx
2015-11-13 09:55:19 +02:00
74463457b3 android: chanhe handles to use alias, tint handles with color
Change-Id: I86ad5eefd70bc8b768780cac66ca466aa0926dc4
2015-11-02 08:48:47 +01:00
37d41674c2 android: don't crash in LO when SurfaceView layout is 0 width
Change-Id: I49be19b273d0c263637369e9b095f374b345191b
2015-11-01 23:06:09 +01:00
9a52bad40a android: don't crash in TextureReaper when Integer is null
Change-Id: I1514aa7a3fbab682b0d282ba0f504470943d7e4a
2015-11-01 22:59:04 +01:00
6d9124de6f android: update JNI facade, rename mouse/keyboard event flags
Change-Id: Ia2b9a812717d05c7d98d47bf0fe5fd293029d045
2015-11-01 22:59:04 +01:00
075c4db284 android: remove MockTileProvider
Change-Id: I1b44c9fa4edfdc79e48f52ba95493f83f0421669
2015-10-21 15:17:10 +02:00
1956b50e3b android: show flat ODS files in the doc browser
I forgot about this when I enabled other Calc file types in
07997cba7745997d7e2ed908a8764ba1f0777f1e (android: adapt doc browser to
updated manifest that accepts Calc documents, 2015-01-19).

Change-Id: Iabacffbfc09d806f09bc7e0f9307830bda8ebbe1
2015-10-15 08:50:50 +02:00
b6430ed7fd tdf#94891 fix crash when rotating screen in docbrowser right after launch
will likely also lose the current directory, but much better than
crashing.

Change-Id: I9ce20e1954a6f58325413046e258ded75b6c8848
2015-10-11 18:13:46 +02:00
143fb0a4b5 move extracting assets to Java & use AssetManager to access assets
using AssetsManager in both java as well as native parts allows to
handle files both with and without compression transparently

Change-Id: If02f1159c498be7ea965fd9c217410722f2dca1f
2015-10-11 02:03:43 +02:00
cdfdf76787 android: avoid arrayIndexOutOfBounds when lokit payload doesn't have a value
and is not handled yet like ".uno:CharFontName="

Change-Id: I09d17b6be9ce9b9c9ae6883f8222c8628268815d
2015-10-03 22:54:38 +02:00
233b9b0ec9 android: make strikethrough work (it's not .uno:StrikeOut, but .uno:Strikeout)
Change-Id: I8d629272cf94eaac406c163c06c9bbdd6a248b79
2015-10-03 22:54:38 +02:00
c320161f48 compare strings using equals, not with ==
Change-Id: I8869980198123bbe9e86e12638e3316be24588c3
2015-10-03 22:54:37 +02:00
7b282e3db8 android: remove unused imports, call static methods the static way
and remove some redundant casts

Change-Id: If58a395227e4b9d54b0d757032d4a55c25315019
2015-10-03 22:54:37 +02:00