Skip to content

Commit f33ccbb

Browse files
committed
CLEAN : Remove redundant initialization
1 parent 7e4567e commit f33ccbb

1 file changed

Lines changed: 9 additions & 10 deletions

File tree

library/src/main/java/com/matpag/clickdrawabletextview/CsDrawableTouchUtils.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ final class CsDrawableTouchUtils {
1616
* <p>vSpace = vertical space available in the TextView</p>
1717
* <p>hSpace = horizontal space available in the TextView</p>
1818
*/
19-
private int vSpace, hSpace = -1;
19+
private int vSpace, hSpace;
2020

2121
/**
2222
* <p>hHeight = half height of the drawable bounds</p>
@@ -83,14 +83,6 @@ boolean isStartDrawableTouched(CsDrawable drawable){
8383
}
8484
}
8585

86-
boolean isTopDrawableTouched(CsDrawable drawable){
87-
hHeight = drawable.getDrawable().getBounds().height() / 2;
88-
hWidth = drawable.getDrawable().getBounds().width() / 2;
89-
centerX = scrollX + view.getCompoundPaddingLeft() + hSpace / 2;
90-
centerY = scrollY + view.getPaddingTop() + hHeight;
91-
return isClickInsideDrawableBounds();
92-
}
93-
9486
boolean isEndDrawableTouched(CsDrawable drawable){
9587
if (isLayoutRTL){
9688
return isLeftDrawableTouched(drawable);
@@ -99,6 +91,14 @@ boolean isEndDrawableTouched(CsDrawable drawable){
9991
}
10092
}
10193

94+
boolean isTopDrawableTouched(CsDrawable drawable){
95+
hHeight = drawable.getDrawable().getBounds().height() / 2;
96+
hWidth = drawable.getDrawable().getBounds().width() / 2;
97+
centerX = scrollX + view.getCompoundPaddingLeft() + hSpace / 2;
98+
centerY = scrollY + view.getPaddingTop() + hHeight;
99+
return isClickInsideDrawableBounds();
100+
}
101+
102102
boolean isBottomDrawableTouched(CsDrawable drawable){
103103
hHeight = drawable.getDrawable().getBounds().height() / 2;
104104
hWidth = drawable.getDrawable().getBounds().width() / 2;
@@ -107,7 +107,6 @@ boolean isBottomDrawableTouched(CsDrawable drawable){
107107
return isClickInsideDrawableBounds();
108108
}
109109

110-
111110
private boolean isLeftDrawableTouched(CsDrawable drawable){
112111
hHeight = drawable.getDrawable().getBounds().height() / 2;
113112
hWidth = drawable.getDrawable().getBounds().width() / 2;

0 commit comments

Comments
 (0)