From db334307d1ebcb94b2ff2c4ea73ec0c2c3f3255e Mon Sep 17 00:00:00 2001 From: chentianyu <18756170827@163.com> Date: Thu, 8 Jul 2021 18:56:05 +0800 Subject: [PATCH] =?UTF-8?q?tooltips=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/tomergoldst/tooltipshm/TextUtils.java | 13 --------- .../tooltipshm/ToolTipsManager.java | 16 +++++----- .../com/tomergoldst/tooltipshm/UiUtils.java | 29 +++++++++++++++++++ 3 files changed, 37 insertions(+), 21 deletions(-) delete mode 100644 tooltips/src/main/java/com/tomergoldst/tooltipshm/TextUtils.java create mode 100644 tooltips/src/main/java/com/tomergoldst/tooltipshm/UiUtils.java diff --git a/tooltips/src/main/java/com/tomergoldst/tooltipshm/TextUtils.java b/tooltips/src/main/java/com/tomergoldst/tooltipshm/TextUtils.java deleted file mode 100644 index d52147f..0000000 --- a/tooltips/src/main/java/com/tomergoldst/tooltipshm/TextUtils.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.tomergoldst.tooltipshm; - -public class TextUtils { - /** - * 判空 - * - * @param str the parms - * @return str - */ - public static boolean isEmpty(CharSequence str) { - return str == null || str.length() == 0; - } -} diff --git a/tooltips/src/main/java/com/tomergoldst/tooltipshm/ToolTipsManager.java b/tooltips/src/main/java/com/tomergoldst/tooltipshm/ToolTipsManager.java index 8f1f4d7..eed452b 100644 --- a/tooltips/src/main/java/com/tomergoldst/tooltipshm/ToolTipsManager.java +++ b/tooltips/src/main/java/com/tomergoldst/tooltipshm/ToolTipsManager.java @@ -186,7 +186,7 @@ public class ToolTipsManager { public void showAbove() { dlAboveCenter.setVisibility(Component.VISIBLE); imacenterAbove.setVisibility(Component.VISIBLE); - String textAbove = TextUtils.isEmpty(mEditText.getText()) ? TIP_TEXT : mEditText.getText().toString(); + String textAbove = UiUtils.isEmpty(mEditText.getText()) ? TIP_TEXT : mEditText.getText().toString(); idAboveImageview.setText(textAbove); idAboveImageview.setTextAlignment(TextAlignment.CENTER); idAboveImageview.setVisibility(Component.VISIBLE); @@ -214,7 +214,7 @@ public class ToolTipsManager { public void showAboveLeft() { dlAboveleft.setVisibility(Component.VISIBLE); imaAboveLeft.setVisibility(Component.VISIBLE); - String textAbove = TextUtils.isEmpty(mEditText.getText()) ? TIP_TEXT : mEditText.getText().toString(); + String textAbove = UiUtils.isEmpty(mEditText.getText()) ? TIP_TEXT : mEditText.getText().toString(); tvAboveLeft.setText(textAbove); tvAboveLeft.setTextAlignment(TextAlignment.CENTER); tvAboveLeft.setVisibility(Component.VISIBLE); @@ -242,7 +242,7 @@ public class ToolTipsManager { public void showAboveRight() { dlAboveRight.setVisibility(Component.VISIBLE); imaAboveRight.setVisibility(Component.VISIBLE); - String textAbove = TextUtils.isEmpty(mEditText.getText()) ? TIP_TEXT : mEditText.getText().toString(); + String textAbove = UiUtils.isEmpty(mEditText.getText()) ? TIP_TEXT : mEditText.getText().toString(); tvAboveRight.setText(textAbove); tvAboveRight.setTextAlignment(TextAlignment.CENTER); tvAboveRight.setVisibility(Component.VISIBLE); @@ -270,7 +270,7 @@ public class ToolTipsManager { public void showBelow() { dlBelowCenter.setVisibility(Component.VISIBLE); imaBelowCenter.setVisibility(Component.VISIBLE); - String textBelow = TextUtils.isEmpty(mEditText.getText()) ? TIP_TEXT : mEditText.getText().toString(); + String textBelow = UiUtils.isEmpty(mEditText.getText()) ? TIP_TEXT : mEditText.getText().toString(); createBelow(idBelowimageView, imaBelowCenter, ResourceTable.Media_media_up); idBelowimageView.setVisibility(Component.VISIBLE); ToolTipCoordinatesFinder.getPositionBelow(textBelow, idBelowimageView, showTextView); @@ -297,7 +297,7 @@ public class ToolTipsManager { public void showBelowLeft() { dlBelowLeft.setVisibility(Component.VISIBLE); imaBelowLeft.setVisibility(Component.VISIBLE); - String textBelow = TextUtils.isEmpty(mEditText.getText()) ? TIP_TEXT : mEditText.getText().toString(); + String textBelow = UiUtils.isEmpty(mEditText.getText()) ? TIP_TEXT : mEditText.getText().toString(); belowImageLeft.setText(textBelow); belowImageLeft.setTextAlignment(TextAlignment.CENTER); belowImageLeft.setVisibility(Component.VISIBLE); @@ -325,7 +325,7 @@ public class ToolTipsManager { public void showBelowRight() { dlBelowRight.setVisibility(Component.VISIBLE); imaBelowRight.setVisibility(Component.VISIBLE); - String textBelow = TextUtils.isEmpty(mEditText.getText()) ? TIP_TEXT : mEditText.getText().toString(); + String textBelow = UiUtils.isEmpty(mEditText.getText()) ? TIP_TEXT : mEditText.getText().toString(); createBelow(belowImageRight, imaBelowRight, ResourceTable.Media_media_up); ToolTipCoordinatesFinder.getPositionBelow(textBelow, belowImageRight, showTextView); visableBelowRight(); @@ -351,7 +351,7 @@ public class ToolTipsManager { public void showLeft() { leftDlView.setVisibility(Component.VISIBLE); imaLeftCenter.setVisibility(Component.VISIBLE); - String textLeft = TextUtils.isEmpty(mEditText.getText()) ? TIP_TEXT_SMALL : mEditText.getText().toString(); + String textLeft = UiUtils.isEmpty(mEditText.getText()) ? TIP_TEXT_SMALL : mEditText.getText().toString(); leftImageView.setVisibility(Component.VISIBLE); createLeft(leftImageView, imaLeftCenter, ResourceTable.Media_arrow_left); leftImageView.setText(textLeft); @@ -379,7 +379,7 @@ public class ToolTipsManager { public void showRight() { rightDlView.setVisibility(Component.VISIBLE); imaRightCenter.setVisibility(Component.VISIBLE); - String textRight = TextUtils.isEmpty(mEditText.getText()) ? TIP_TEXT_LARGE : mEditText.getText().toString(); + String textRight = UiUtils.isEmpty(mEditText.getText()) ? TIP_TEXT_LARGE : mEditText.getText().toString(); rightDlView.setVisibility(Component.VISIBLE); createRight(rightImageView, imaRightCenter, ResourceTable.Media_arrow_right); ToolTipCoordinatesFinder.getPositionRightTo(textRight, showTextView, rightImageView); diff --git a/tooltips/src/main/java/com/tomergoldst/tooltipshm/UiUtils.java b/tooltips/src/main/java/com/tomergoldst/tooltipshm/UiUtils.java new file mode 100644 index 0000000..f4e6ed2 --- /dev/null +++ b/tooltips/src/main/java/com/tomergoldst/tooltipshm/UiUtils.java @@ -0,0 +1,29 @@ +/* +Copyright 2016 Tomer Goldstein + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package com.tomergoldst.tooltipshm; + +public class UiUtils { + /** + * 判空 + * + * @param str the parms + * @return str + */ + public static boolean isEmpty(CharSequence str) { + return str == null || str.length() == 0; + } +} -- Gitee