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 d52147f7549953de649e94b91be398d60650afae..0000000000000000000000000000000000000000 --- 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 8f1f4d7d8aa767bc34e77756b337c4401b3c945c..eed452bad3241b844e5312cd969e817d037f013b 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 0000000000000000000000000000000000000000..f4e6ed2e1d6c0d7088566f507c562764793fb719 --- /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; + } +}