[Libreoffice-commits] core.git: android/source

Ximeng Zu uznomis at yahoo.com
Sun Aug 27 18:40:44 UTC 2017


 android/source/src/java/org/libreoffice/SearchController.java              |    4 ++--
 android/source/src/java/org/libreoffice/canvas/AdjustLengthLine.java       |    7 ++-----
 android/source/src/java/org/libreoffice/overlay/CalcHeadersController.java |    6 ++----
 android/source/src/java/org/libreoffice/overlay/CalcHeadersView.java       |    9 ++-------
 4 files changed, 8 insertions(+), 18 deletions(-)

New commits:
commit 218ea8750827982dc325fb0f0daa6d9f4b2dc044
Author: Ximeng Zu <uznomis at yahoo.com>
Date:   Sun Aug 20 18:15:46 2017 -0500

    [Android] Clean up util func with Calc dev
    
    Removed redundant util functions addProperty
    and twipToPixel in several Calc related classes.
    
    Change-Id: I169be2edf74e662d5c3e3fcbd80265e9a694598d
    Reviewed-on: https://gerrit.libreoffice.org/41372
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/android/source/src/java/org/libreoffice/SearchController.java b/android/source/src/java/org/libreoffice/SearchController.java
index 14782a0a95ed..09652e9958be 100644
--- a/android/source/src/java/org/libreoffice/SearchController.java
+++ b/android/source/src/java/org/libreoffice/SearchController.java
@@ -7,7 +7,7 @@ import android.widget.ImageButton;
 import org.json.JSONException;
 import org.json.JSONObject;
 
-class SearchController implements View.OnClickListener {
+public class SearchController implements View.OnClickListener {
     private LibreOfficeMainActivity mActivity;
 
     private enum SearchDirection {
@@ -38,7 +38,7 @@ class SearchController implements View.OnClickListener {
         }
     }
 
-    private void addProperty(JSONObject json, String parentValue, String type, String value) throws JSONException {
+    public static void addProperty(JSONObject json, String parentValue, String type, String value) throws JSONException {
         JSONObject child = new JSONObject();
         child.put("type", type);
         child.put("value", value);
diff --git a/android/source/src/java/org/libreoffice/canvas/AdjustLengthLine.java b/android/source/src/java/org/libreoffice/canvas/AdjustLengthLine.java
index f0120bcbb5dc..fbdb429f2d10 100644
--- a/android/source/src/java/org/libreoffice/canvas/AdjustLengthLine.java
+++ b/android/source/src/java/org/libreoffice/canvas/AdjustLengthLine.java
@@ -14,7 +14,8 @@ import org.libreoffice.LibreOfficeMainActivity;
 import org.libreoffice.overlay.CalcHeadersView;
 import org.mozilla.gecko.gfx.ImmutableViewportMetrics;
 
-import static org.libreoffice.overlay.CalcHeadersView.addProperty;
+import static org.libreoffice.SearchController.addProperty;
+import static org.libreoffice.UnitConverter.pixelToTwip;
 
 public class AdjustLengthLine extends CommonCanvasElement {
 
@@ -98,8 +99,4 @@ public class AdjustLengthLine extends CommonCanvasElement {
         mStartScreenPosition = new PointF(position.left, position.top);
         mIndex = 1 + mCalcHeadersView.getIndexFromPointOfTouch(new PointF(position.centerX(), position.centerY()));
     }
-
-    private static float pixelToTwip(float input, float dpi) {
-        return (input / dpi) * 1440.0f;
-    }
 }
diff --git a/android/source/src/java/org/libreoffice/overlay/CalcHeadersController.java b/android/source/src/java/org/libreoffice/overlay/CalcHeadersController.java
index 954277c20ed2..78a329adfe94 100644
--- a/android/source/src/java/org/libreoffice/overlay/CalcHeadersController.java
+++ b/android/source/src/java/org/libreoffice/overlay/CalcHeadersController.java
@@ -25,6 +25,8 @@ import org.mozilla.gecko.gfx.LayerView;
 
 import java.util.ArrayList;
 
+import static org.libreoffice.UnitConverter.twipToPixel;
+
 public class CalcHeadersController {
     private static final String LOGTAG = CalcHeadersController.class.getSimpleName();
 
@@ -198,10 +200,6 @@ public class CalcHeadersController {
         return null;
     }
 
-    private float twipToPixel(float input, float dpi) {
-        return input / 1440.0f * dpi;
-    }
-
     public void showHeaderSelection(RectF cellCursorRect) {
         mCalcRowHeadersView.setHeaderSelection(cellCursorRect);
         mCalcColumnHeadersView.setHeaderSelection(cellCursorRect);
diff --git a/android/source/src/java/org/libreoffice/overlay/CalcHeadersView.java b/android/source/src/java/org/libreoffice/overlay/CalcHeadersView.java
index bc74bab04f77..a8b2d2048409 100644
--- a/android/source/src/java/org/libreoffice/overlay/CalcHeadersView.java
+++ b/android/source/src/java/org/libreoffice/overlay/CalcHeadersView.java
@@ -24,6 +24,8 @@ import org.mozilla.gecko.gfx.LayerView;
 import java.util.ArrayList;
 import java.util.Collections;
 
+import static org.libreoffice.SearchController.addProperty;
+
 public class CalcHeadersView extends View {
     private static final String LOGTAG = CalcHeadersView.class.getSimpleName();
 
@@ -187,13 +189,6 @@ public class CalcHeadersView extends View {
         return mPendingRowOrColumnSelectionToShowUp;
     }
 
-    public static void addProperty(JSONObject json, String parentValue, String type, String value) throws JSONException {
-        JSONObject child = new JSONObject();
-        child.put("type", type);
-        child.put("value", value);
-        json.put(parentValue, child);
-    }
-
     public void setHeaders(ArrayList<String> labels, ArrayList<Float> dimens) {
         mLabels = labels;
         mDimens = dimens;


More information about the Libreoffice-commits mailing list