diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2021-04-13 07:55:54 +0200 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2021-04-14 10:25:46 +0200 |
commit | 4db8535fba00c476555e09e32e521993ab77dc4d (patch) | |
tree | 17fa093ba4f506af4c769935a032e27e0e8a701b /android | |
parent | b7a38c1dfeab7c5eebb7fd5bc571e68b343bffb7 (diff) |
android: Don't store whether spreadsheet in LibreOfficeMainActivity
LOKitTileProvider has that information, so query it instead
and don't duplicate information in LibreOfficeMainActivity.
Change-Id: I233986d6e94e5676464cb3399303efd545e33d32
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114057
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'android')
5 files changed, 6 insertions, 17 deletions
diff --git a/android/source/src/java/org/libreoffice/FontController.java b/android/source/src/java/org/libreoffice/FontController.java index a00e13e1485c..8729b51e01ac 100644 --- a/android/source/src/java/org/libreoffice/FontController.java +++ b/android/source/src/java/org/libreoffice/FontController.java @@ -158,7 +158,7 @@ public class FontController implements AdapterView.OnItemSelectedListener { JSONObject valueJson = new JSONObject(); valueJson.put("type", "long"); valueJson.put("value", 0x00FFFFFF & color); - if(mActivity.isSpreadsheet()){ + if(mActivity.getTileProvider().isSpreadsheet()){ json.put("BackgroundColor", valueJson); LOKitShell.sendEvent(new LOEvent(LOEvent.UNO_COMMAND, ".uno:BackgroundColor", json.toString())); }else if(mActivity.getTileProvider().isPresentation()){ diff --git a/android/source/src/java/org/libreoffice/InvalidationHandler.java b/android/source/src/java/org/libreoffice/InvalidationHandler.java index 588fec9f5372..b74d92d15460 100644 --- a/android/source/src/java/org/libreoffice/InvalidationHandler.java +++ b/android/source/src/java/org/libreoffice/InvalidationHandler.java @@ -505,7 +505,7 @@ public class InvalidationHandler implements Document.MessageCallback, Office.Mes changeStateTo(OverlayState.TRANSITION); } mDocumentOverlay.changeSelections(Collections.<RectF>emptyList()); - if (mContext.isSpreadsheet()) { + if (mContext.getTileProvider().isSpreadsheet()) { mDocumentOverlay.showHeaderSelection(null); } mContext.getToolbarController().showHideClipboardCutAndCopy(false); @@ -516,7 +516,7 @@ public class InvalidationHandler implements Document.MessageCallback, Office.Mes } changeStateTo(OverlayState.SELECTION); mDocumentOverlay.changeSelections(rectangles); - if (mContext.isSpreadsheet()) { + if (mContext.getTileProvider().isSpreadsheet()) { mDocumentOverlay.showHeaderSelection(rectangles.get(0)); } String selectedText = mContext.getTileProvider().getTextSelection(""); diff --git a/android/source/src/java/org/libreoffice/LOKitShell.java b/android/source/src/java/org/libreoffice/LOKitShell.java index 43dd30a69847..5fb7159f1032 100644 --- a/android/source/src/java/org/libreoffice/LOKitShell.java +++ b/android/source/src/java/org/libreoffice/LOKitShell.java @@ -27,7 +27,9 @@ public class LOKitShell { private static final String LOGTAG = LOKitShell.class.getSimpleName(); public static float getDpi(Context context) { - if (((LibreOfficeMainActivity)context).isSpreadsheet()) return 96f; + LOKitTileProvider tileProvider = ((LibreOfficeMainActivity)context).getTileProvider(); + if (tileProvider != null && tileProvider.isSpreadsheet()) + return 96f; DisplayMetrics metrics = context.getResources().getDisplayMetrics(); return metrics.density * 160; } diff --git a/android/source/src/java/org/libreoffice/LOKitTileProvider.java b/android/source/src/java/org/libreoffice/LOKitTileProvider.java index e9fc2d52a154..2fb3551eada2 100644 --- a/android/source/src/java/org/libreoffice/LOKitTileProvider.java +++ b/android/source/src/java/org/libreoffice/LOKitTileProvider.java @@ -102,10 +102,6 @@ class LOKitTileProvider implements TileProvider { Log.i(LOGTAG, "====> mDocument = " + mDocument); - if(isSpreadsheet()) { - mContext.setIsSpreadsheet(true); // Calc is treated differently e.g. DPI = 96f - } - mDPI = LOKitShell.getDpi(mContext); mTileWidth = pixelToTwip(TILE_SIZE, mDPI); mTileHeight = pixelToTwip(TILE_SIZE, mDPI); diff --git a/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java b/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java index f751f2e7dd61..a3f62601c1c4 100644 --- a/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java +++ b/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java @@ -94,7 +94,6 @@ public class LibreOfficeMainActivity extends AppCompatActivity implements Settin private SearchController mSearchController; private UNOCommandsController mUNOCommandsController; private CalcHeadersController mCalcHeadersController; - private boolean mIsSpreadsheet; private LOKitTileProvider mTileProvider; private String mPassword; private boolean mPasswordProtected; @@ -815,14 +814,6 @@ public class LibreOfficeMainActivity extends AppCompatActivity implements Settin }); } - public void setIsSpreadsheet(boolean b) { - mIsSpreadsheet = b; - } - - public boolean isSpreadsheet() { - return mIsSpreadsheet; - } - public static boolean isReadOnlyMode() { return mbISReadOnlyMode; } |