diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2024-05-22 13:50:24 +0200 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2024-05-23 15:53:26 +0200 |
commit | 6bab5485913ca99feb00855a20171a8a770f0469 (patch) | |
tree | 10a5328352966f4b07b4d95538fa4551a8835e59 /android/source/src/java | |
parent | 693b21954581c608b7ef456c799ecbd3f46b9918 (diff) |
android: Use "compact_fonts" LibreOfficeKit option
For Android Viewer, set the "compact_fonts" LibreOfficeKit
option via environment variable `SAL_LOK_OPTIONS` introduced in
Change-Id: I3dc9f5de876def6e4afc09a43105b1740f7c621f
Author: Michael Meeks <michael.meeks@collabora.com>
Date: Fri May 17 21:25:29 2024 +0100
lok: stop amazing waste of repeated font sizes in each font element.
and adjust the handling in `FontController` to process
the flat lists for font names and sizes that is reported
with that options set, rather than processing
font sizes for each individual font.
(See also discussion in original Gerrit change
for the distro/collabora/co-24.04 branch: [1].).
[1] https://gerrit.libreoffice.org/c/core/+/167799
Change-Id: I85734c1876d152f4f95f9182629affd6b250fdbc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167963
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
Diffstat (limited to 'android/source/src/java')
-rw-r--r-- | android/source/src/java/org/libreoffice/FontController.java | 37 | ||||
-rw-r--r-- | android/source/src/java/org/libreoffice/LOKitTileProvider.java | 1 |
2 files changed, 10 insertions, 28 deletions
diff --git a/android/source/src/java/org/libreoffice/FontController.java b/android/source/src/java/org/libreoffice/FontController.java index 72f35d8b42d8..211b9d6c8b56 100644 --- a/android/source/src/java/org/libreoffice/FontController.java +++ b/android/source/src/java/org/libreoffice/FontController.java @@ -19,8 +19,6 @@ import org.json.JSONException; import org.json.JSONObject; import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; public class FontController implements AdapterView.OnItemSelectedListener { @@ -32,7 +30,6 @@ public class FontController implements AdapterView.OnItemSelectedListener { private final LibreOfficeMainActivity mActivity; private final ArrayList<String> mFontList = new ArrayList<>(); private final ArrayList<String> mFontSizes = new ArrayList<>(); - private final HashMap<String, ArrayList<String>> mAllFontSizes = new HashMap<>(); private String mCurrentFontSelected = null; private String mCurrentFontSizeSelected = null; @@ -210,21 +207,17 @@ public class FontController implements AdapterView.OnItemSelectedListener { public void parseJson(String json) { mFontList.clear(); - mAllFontSizes.clear(); + mFontSizes.clear(); try { JSONObject jObject = new JSONObject(json); - JSONObject jObject2 = jObject.getJSONObject("commandValues"); - Iterator<String> keys = jObject2.keys(); - ArrayList<String> fontSizes; - while (keys.hasNext()) { - String key = keys.next(); - mFontList.add(key); - JSONArray array = jObject2.getJSONArray(key); - fontSizes = new ArrayList<>(); - for (int i = 0; i < array.length(); i++) { - fontSizes.add(array.getString(i)); - } - mAllFontSizes.put(key, fontSizes); + final JSONArray fontNameArray = jObject.getJSONArray("FontNames"); + for (int i = 0; i < fontNameArray.length(); i++) { + mFontList.add(fontNameArray.getString(i)); + } + + final JSONArray fontSizeArray = jObject.getJSONArray("FontSizes"); + for (int i = 0; i < fontSizeArray.length(); i++) { + mFontSizes.add(fontSizeArray.getString(i)); } } catch (JSONException e) { e.printStackTrace(); @@ -405,18 +398,6 @@ public class FontController implements AdapterView.OnItemSelectedListener { mCurrentFontSelected = fontName; spinner.setSelection(position,false); } - - resetFontSizes(fontName); - } - - private void resetFontSizes(String fontName) { - if (mAllFontSizes.get(fontName) != null) { - mFontSizes.clear(); - mFontSizes.addAll(mAllFontSizes.get(fontName)); - Spinner spinner = mActivity.findViewById(R.id.font_size_spinner); - ArrayAdapter<?> arrayAdapter = (ArrayAdapter<?>)spinner.getAdapter(); - arrayAdapter.notifyDataSetChanged(); - } } public void selectFontSize(final String fontSize) { diff --git a/android/source/src/java/org/libreoffice/LOKitTileProvider.java b/android/source/src/java/org/libreoffice/LOKitTileProvider.java index 5d1cf12209dc..c8a055206dd0 100644 --- a/android/source/src/java/org/libreoffice/LOKitTileProvider.java +++ b/android/source/src/java/org/libreoffice/LOKitTileProvider.java @@ -64,6 +64,7 @@ class LOKitTileProvider implements TileProvider { mMessageCallback = messageCallback; LibreOfficeKit.putenv("SAL_LOG=+WARN+INFO"); + LibreOfficeKit.putenv("SAL_LOK_OPTIONS=compact_fonts"); LibreOfficeKit.init(mContext); mOffice = new Office(LibreOfficeKit.getLibreOfficeKitHandle()); |