The naming for the directions UP and DOWN were used the wrong way
around, which was also apparent when looking at
'android/source/res/layout/toolbar_bottom.xml', where icon
'"@drawable/ic_search_direction_down"' was assigned to the
button with ID "@+id/button_search_up" (and vice versa).
Adapt the naming to avoid confusion.
Change-Id: I5cf59f1789f2c12651ce6a5638d559658d9d4deb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90091
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
I cannot tell how to reproduce (how to open a file of "invalid type"?),
but had a crash with this stacktrace in adb log at some point
when testing various scenarios with the Android Viewer app.
It shows that no proper value was assigned for the resource ID,
leaving the default 0. Just don't set an icon in this case.
E AndroidRuntime: FATAL EXCEPTION: main
E AndroidRuntime: Process: org.libreoffice, PID: 8749
E AndroidRuntime: android.content.res.Resources$NotFoundException: Resource ID #0x0
E AndroidRuntime: at android.content.res.ResourcesImpl.getValueForDensity(ResourcesImpl.java:246)
E AndroidRuntime: at android.content.res.Resources.getDrawableForDensity(Resources.java:905)
E AndroidRuntime: at android.content.res.Resources.getDrawable(Resources.java:845)
E AndroidRuntime: at android.content.Context.getDrawable(Context.java:687)
E AndroidRuntime: at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:358)
E AndroidRuntime: at org.libreoffice.ui.RecentFilesAdapter.onBindViewHolder(RecentFilesAdapter.java:73)
E AndroidRuntime: at org.libreoffice.ui.RecentFilesAdapter.onBindViewHolder(RecentFilesAdapter.java:25)
E AndroidRuntime: at android.support.v7.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:6673)
E AndroidRuntime: at android.support.v7.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:6714)
E AndroidRuntime: at android.support.v7.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline(RecyclerView.java:5647)
E AndroidRuntime: at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5913)
E AndroidRuntime: at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5752)
E AndroidRuntime: at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5748)
E AndroidRuntime: at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2232)
E AndroidRuntime: at android.support.v7.widget.GridLayoutManager.layoutChunk(GridLayoutManager.java:556)
E AndroidRuntime: at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1519)
E AndroidRuntime: at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:614)
E AndroidRuntime: at android.support.v7.widget.GridLayoutManager.onLayoutChildren(GridLayoutManager.java:170)
E AndroidRuntime: at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3812)
E AndroidRuntime: at android.support.v7.widget.RecyclerView.onMeasure(RecyclerView.java:3225)
[...]
Change-Id: I05594c3da26125a18be9226f290430aa9c7fa14c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90090
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
This fixes as another crash with Android Viewer that
could (ocassionaly) be observed by
* open some ODT document
* press the "back button" while the document is still
being loaded
* repeat steps 1-2 until the crash occurs
Corresponding 'adb logcat' output:
I LibreOfficeMainActivity: onDestroy..
I LOKitTileProvider: Document destroyed: /storage/emulated/0/Download/simple.odt
D LOKitThread: mTileProvider==null when calling updatePartPageRectangles
D AndroidRuntime: Shutting down VM
E AndroidRuntime: FATAL EXCEPTION: main
E AndroidRuntime: Process: org.libreoffice, PID: 9190
E AndroidRuntime: java.lang.NullPointerException: Attempt to invoke interface method 'boolean org.libreoffice.TileProvider.isSpreadsheet()' on a null object reference
E AndroidRuntime: at org.libreoffice.LOKitThread.refresh(LOKitThread.java:159)
E AndroidRuntime: at org.libreoffice.LOKitThread.access$000(LOKitThread.java:26)
E AndroidRuntime: at org.libreoffice.LOKitThread$1.run(LOKitThread.java:239)
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: I9787a13b3485a87a133f8b5e4e03bbf3618fb2f0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90089
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
'mTileProvider' can be null here, e.g. while loading the document.
This fixes a crash that could be reproduced e.g. by
* open a document
* press the "back button" while the document is still
being loaded
(Most easily reproducibly right after app installation, since
loading the first doc takes a very long time then.)
Relevant log messages from `adb logcat` output:
E AndroidRuntime: java.lang.RuntimeException: Unable to stop activity {org.libreoffice/org.libreoffice.LibreOfficeMainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void org.libreoffice.LOKitTileProvider.cacheDocument()' on a null object reference
E AndroidRuntime: at android.app.ActivityThread.callActivityOnStop(ActivityThread.java:4624)
E AndroidRuntime: at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:4594)
E AndroidRuntime: at android.app.ActivityThread.handleStopActivity(ActivityThread.java:4669)
E AndroidRuntime: at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:233)
E AndroidRuntime: at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:201)
E AndroidRuntime: at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:173)
E AndroidRuntime: at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016)
E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:107)
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)
E AndroidRuntime: Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void org.libreoffice.LOKitTileProvider.cacheDocument()' on a null object reference
E AndroidRuntime: at org.libreoffice.LibreOfficeMainActivity.onStop(LibreOfficeMainActivity.java:427)
E AndroidRuntime: at android.app.Instrumentation.callActivityOnStop(Instrumentation.java:1466)
E AndroidRuntime: at android.app.Activity.performStop(Activity.java:8018)
E AndroidRuntime: at android.app.ActivityThread.callActivityOnStop(ActivityThread.java:4616)
E AndroidRuntime: ... 13 more
Change-Id: I9f8a9329801b721dbfbc0a49c150f88ec341059c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90088
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
'mViewportMetrics' can be null here, e.g. while the document is
still being loaded.
This fixes a crash that happened e.g. when tapping on the screen
while document was still being loaded.
Change-Id: Ib3f237ecf64c05a5736d97e00b46d0de2ef051a0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90048
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Instead of hard-coding the use of English as default
locale and allowing manually selecting another language,
this now makes the system's default locale to be used
by default in the Android Viewer. It's still possible to
explicitly select another language to override that.
In case there is no localization for the system locale,
an automatic fallback to English happens anyway, so there
should be no need to explicitly set the locale to English
in that case either.
Change-Id: I0b8cfafea6a4659c3657522cfd5895c00f25f054
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85583
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Previously, the call to 'ColorPaletteAdapter::setColorPalette' from
the 'ColorPickerAdapter' constructur (via 'initializeColorPalette')
would not just set the color palette, but also apply the color at
index (0, 0) to the current selection, since
'ColorPaleteAdapter::setPosition' calls
'colorPaletteListener.applyColor' after setting the position.
This is an undesirable side effect, and led to the situation described
in tdf#115698 that cell A1 would always get black background when
opening a spreadsheet in the Android viewer, since black is the color
at 'color_palette[0][0]' by default and cell A1 is explicitly selected
when Calc first opens, s. the 'CalcHeadersController' constructor.
For Writer, something similar could be reproduced by selecting a
word in a document using long-tap. If experimental editing mode was
enabled, that word got black background (other words selected
later didn't).
To avoid this, make 'ColorPaletteAdapter::setColorPalette' just set
the color palette and set back the values that indicate what is
selected but don't apply any color. (And make 'setColorPalette'
just take the palette as parameter, and set 0 for both start values,
as the only caller was doing as well).
Change-Id: I0fa720ac6550102701a2c82905c9720aab6daab2
Reviewed-on: https://gerrit.libreoffice.org/85044
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Michael Weghorn <m.weghorn@posteo.de>
The comment mentioning "Calc has a fixed zoom at 1x
and doesn't allow zooming for now" was there since
support for the Calc UI was added in commit
02f3c4848a ("Calc UI
on Android Viewer") in 2017. That seems no longer to be
the case however, probably since commit
498dceb43f
("sc lok: Implement hi-dpi and zoom for spreadsheets.").
Zooming in and out was working just fine when I tested this
with Android Viewer using a spreadsheet containing some text
and numbers, as well as a chart and an image.
Therefore, allow zooming for Calc as well.
Don't allow to set min zoom below the page width for Calc as
somewhat suggested by the existing comment ("applies to all
types of document; in the future spreadsheets may be
singled out"). I don't see a particular reason for this and
using 0f for minZoom would break double-tap zoom.
Change-Id: Ib08439edbbac59a00005213b533df5792da965ee
Reviewed-on: https://gerrit.libreoffice.org/84421
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
when the user wildly switches documents in fast succession, mDocument
can be null - not creating a cache file definitely is better than a hard
crash....
Also onSaveInstanceState is meant for lightweight operations (e.g.
storing what file was openend and what position it was scrolled to), not
for backend-storing of data, so move creation of cache file to onStop
instead.
Change-Id: I2452ef24e309ea4a9594eb723e893798b9b47d98
Reviewed-on: https://gerrit.libreoffice.org/82774
Tested-by: Jenkins
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
typie is ArrayList<Float> - and code divides by/multiplies by zoom
factor later on, so won't keep whole numbers/changing remaining code to
Long would require rounding or reworking the rest of the code as well...
fallout from https://gerrit.libreoffice.org/#/c/82572/
Change-Id: I3f3c46c59f9a310bf48b8cb8b533fe51c9d6645e
Reviewed-on: https://gerrit.libreoffice.org/82775
Tested-by: Jenkins
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
This simplifies lots of logic in the clients, making it trivial to get
good row/column header alignment at any zoom. Ultimately TWIPS here are
highly misleading print-twips, and in this state are ~impossible to map
to pixels accurately unless all data is present back to the origin
(which is not the current approach).
Change-Id: I6ca30e77865b62e886e23860f7c23350e544c9fc
Reviewed-on: https://gerrit.libreoffice.org/82572
Tested-by: Jenkins
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Typically application should handle key press/release and multiple
actions. The onKeyPreIme may be used to handle some keys early and it's
not needed for writing text. And even if there would be a reason to use
it, then it should return true to notify that the event was handled
(otherwise we will get onKeyDown event for the same key).
Change-Id: I49ce7f411fac92ff86ca042a7f7467e910e46350
Reviewed-on: https://gerrit.libreoffice.org/66708
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
missing break causes bug on buttons on Formatting tab
This patch is sponsored by ULAKBIM/Pardus project.
Signed-off-by: Mert Tumer <merttumer@outlook.com>
Change-Id: I8a20b542aa319591e9dea5591ed554954222d690
Reviewed-on: https://gerrit.libreoffice.org/62756
Tested-by: Jenkins
Reviewed-by: Gülşah Köse <gulsah.1004@gmail.com>
ignore hidden files statment is obsolete because
we put option on settings whether they are shown or not
This patch is sponsored by ULAKBIM/Pardus project.
Signed-off-by: Mert Tumer <merttumer@outlook.com>
Change-Id: Ibba7ed76c20a189cff04e330a4493b3e84e5dba2
Reviewed-on: https://gerrit.libreoffice.org/62754
Tested-by: Jenkins
Reviewed-by: Gülşah Köse <gulsah.1004@gmail.com>
More hardcoded strings extrated to the resource file
Few Turkish language improvements
This patch is sponsored by ULAKBIM/Pardus project.
Signed-off-by: Mert Tumer <merttumer@outlook.com>
Change-Id: I9c49d1b8ec3dfc88a19832a2cdea2c7cbaf2be42
Reviewed-on: https://gerrit.libreoffice.org/62757
Tested-by: Jenkins
Reviewed-by: Gülşah Köse <gulsah.1004@gmail.com>
We ask READ_EXTERNAL_STORAGE permission on first start
then check WRITE_EXTERNAL_STORAGE permission on switching
between document providers. This causes problems on Android 8+
Signed-off-by: Mert Tumer <merttumer@outlook.com>
Change-Id: Ia7290e33b2a55f5a2197374ca39c60998edfff72
Reviewed-on: https://gerrit.libreoffice.org/62269
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
Tested-by: Jenkins
Added an settings option to enable Developer
Mode, in which you can send UNO commands
from the Viewer. You can also add properties
to the command.
Change-Id: I76cbb55771cdd5cea89da65ddf67e48e12745b41
Reviewed-on: https://gerrit.libreoffice.org/37045
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
This is a base change, further implementations may be added
Change-Id: I8aa5b5314f2b1e93821baf3da3e44803904f57fa
Reviewed-on: https://gerrit.libreoffice.org/57249
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
This patch prevents document browsing and creating
a new document from happening when write external
storage permission is denied by the user.
Signed-off-by: Mert Tümer <merttumer7@gmail.com>
Change-Id: Idf39a291a15a9dac023f4318329baed1baa90e14
Reviewed-on: https://gerrit.libreoffice.org/52868
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>