From 64af8fc4fe0fbf828c3398897580ce986f16ecf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=89=E1=85=A5=E1=84=8B=E1=85=AA=E1=86=AB=E1=84=89?= =?UTF-8?q?=E1=85=A5=E1=86=A8?= <> Date: Mon, 10 Oct 2022 00:45:23 +0900 Subject: [PATCH 1/2] add android subCaption property to Maker --- .../quadflask/react/navermap/RNNaverMapMarker.java | 11 +++++++++++ .../react/navermap/RNNaverMapMarkerManager.java | 14 ++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/android/src/main/java/com/github/quadflask/react/navermap/RNNaverMapMarker.java b/android/src/main/java/com/github/quadflask/react/navermap/RNNaverMapMarker.java index 5578cd7f..2ec573a5 100644 --- a/android/src/main/java/com/github/quadflask/react/navermap/RNNaverMapMarker.java +++ b/android/src/main/java/com/github/quadflask/react/navermap/RNNaverMapMarker.java @@ -161,6 +161,17 @@ public void removeCaption() { feature.setCaptionText(""); } + public void setSubCaption(String text, int textSize, int color, int haloColor) { + feature.setSubCaptionText(text); + feature.setSubCaptionTextSize(textSize); + feature.setSubCaptionColor(color); + feature.setSubCaptionHaloColor(haloColor); + } + + public void removeSubCaption() { + feature.setSubCaptionText(""); + } + public void setImage(String uri) { if (uri != null) { OverlayImage overlayImage = OverlayImages.get(uri); diff --git a/android/src/main/java/com/github/quadflask/react/navermap/RNNaverMapMarkerManager.java b/android/src/main/java/com/github/quadflask/react/navermap/RNNaverMapMarkerManager.java index 5dcdb274..8d631671 100644 --- a/android/src/main/java/com/github/quadflask/react/navermap/RNNaverMapMarkerManager.java +++ b/android/src/main/java/com/github/quadflask/react/navermap/RNNaverMapMarkerManager.java @@ -143,6 +143,20 @@ public void setCaption(RNNaverMapMarker view, ReadableMap map) { view.setCaption(text, textSize, color, haloColor, offset, align); } + @ReactProp(name = "subCaption") + public void setSubCaption(RNNaverMapMarker view, ReadableMap map) { + if (map == null || !map.hasKey("text")) { + view.removeSubCaption(); + return; + } + String text = map.getString("text"); + int textSize = map.hasKey("textSize") ? map.getInt("textSize") : 15; + int color = map.hasKey("color") ? parseColorString(map.getString("color")) : Color.BLACK; + int haloColor = map.hasKey("haloColor") ? parseColorString(map.getString("haloColor")) : Color.WHITE; + + view.setSubCaption(text, textSize, color, haloColor, align); + } + @Override public void addView(RNNaverMapMarker parent, View child, int index) { parent.setCustomView(child, index); From 74e5c4d15476c8138d42d6197e4ddc27bc01c339 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=89=E1=85=A5=E1=84=8B=E1=85=AA=E1=86=AB=E1=84=89?= =?UTF-8?q?=E1=85=A5=E1=86=A8?= <> Date: Mon, 10 Oct 2022 01:28:34 +0900 Subject: [PATCH 2/2] Android apply isHideCollidedCaptions --- .../github/quadflask/react/navermap/RNNaverMapMarker.java | 6 +++++- .../quadflask/react/navermap/RNNaverMapMarkerManager.java | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/android/src/main/java/com/github/quadflask/react/navermap/RNNaverMapMarker.java b/android/src/main/java/com/github/quadflask/react/navermap/RNNaverMapMarker.java index 2ec573a5..337200dc 100644 --- a/android/src/main/java/com/github/quadflask/react/navermap/RNNaverMapMarker.java +++ b/android/src/main/java/com/github/quadflask/react/navermap/RNNaverMapMarker.java @@ -148,6 +148,10 @@ public void setHeight(int height) { feature.setHeight(height); } + public void setHideCollidedCaptions(boolean isHideCollidedCaptions) { + feature.setHideCollidedCaptions(isHideCollidedCaptions); + } + public void setCaption(String text, int textSize, int color, int haloColor, int offset, Align... aligns) { feature.setCaptionText(text); feature.setCaptionTextSize(textSize); @@ -167,7 +171,7 @@ public void setSubCaption(String text, int textSize, int color, int haloColor) { feature.setSubCaptionColor(color); feature.setSubCaptionHaloColor(haloColor); } - + public void removeSubCaption() { feature.setSubCaptionText(""); } diff --git a/android/src/main/java/com/github/quadflask/react/navermap/RNNaverMapMarkerManager.java b/android/src/main/java/com/github/quadflask/react/navermap/RNNaverMapMarkerManager.java index 8d631671..14cc4267 100644 --- a/android/src/main/java/com/github/quadflask/react/navermap/RNNaverMapMarkerManager.java +++ b/android/src/main/java/com/github/quadflask/react/navermap/RNNaverMapMarkerManager.java @@ -127,6 +127,11 @@ public void setZIndex(RNNaverMapMarker view, int zIndex) { view.setZIndex(zIndex); } + @ReactProp(name = "isHideCollidedCaptions", defaultBoolean = false) + public void setHideCollidedCaptions(RNNaverMapMarker view, boolean isHideCollidedCaptions) { + view.setHideCollidedCaptions(isHideCollidedCaptions); + } + @ReactProp(name = "caption") public void setCaption(RNNaverMapMarker view, ReadableMap map) { if (map == null || !map.hasKey("text")) { @@ -154,7 +159,7 @@ public void setSubCaption(RNNaverMapMarker view, ReadableMap map) { int color = map.hasKey("color") ? parseColorString(map.getString("color")) : Color.BLACK; int haloColor = map.hasKey("haloColor") ? parseColorString(map.getString("haloColor")) : Color.WHITE; - view.setSubCaption(text, textSize, color, haloColor, align); + view.setSubCaption(text, textSize, color, haloColor); } @Override