Skip to content

Commit

Permalink
Merge pull request rengwuxian#202 from Ron-Cai/clear_button_disabled
Browse files Browse the repository at this point in the history
Clear button would not be shown if the EditText is disabled
  • Loading branch information
rengwuxian committed Dec 30, 2015
2 parents 11d5e7d + 6338fcf commit 7e0e045
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1291,7 +1291,7 @@ protected void onDraw(@NonNull Canvas canvas) {
}

// draw the clear button
if (hasFocus() && showClearButton && !TextUtils.isEmpty(getText())) {
if (hasFocus() && showClearButton && !TextUtils.isEmpty(getText()) && isEnabled()) {
paint.setAlpha(255);
int buttonLeft;
if (isRTL()) {
Expand Down Expand Up @@ -1463,7 +1463,7 @@ public boolean onTouchEvent(MotionEvent event) {
setSelection(0);
return false;
}
if (hasFocus() && showClearButton) {
if (hasFocus() && showClearButton && isEnabled()) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
if (insideClearButton(event)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1295,7 +1295,7 @@ protected void onDraw(@NonNull Canvas canvas) {
}

// draw the clear button
if (hasFocus() && showClearButton && !TextUtils.isEmpty(getText())) {
if (hasFocus() && showClearButton && !TextUtils.isEmpty(getText()) && isEnabled()) {
paint.setAlpha(255);
int buttonLeft;
if (isRTL()) {
Expand Down Expand Up @@ -1467,7 +1467,7 @@ public boolean onTouchEvent(MotionEvent event) {
setSelection(0);
return false;
}
if (hasFocus() && showClearButton) {
if (hasFocus() && showClearButton && isEnabled()) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
if (insideClearButton(event)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1288,7 +1288,7 @@ protected void onDraw(@NonNull Canvas canvas) {
}

// draw the clear button
if (hasFocus() && showClearButton && !TextUtils.isEmpty(getText())) {
if (hasFocus() && showClearButton && !TextUtils.isEmpty(getText()) && isEnabled()) {
paint.setAlpha(255);
int buttonLeft;
if (isRTL()) {
Expand Down Expand Up @@ -1460,7 +1460,7 @@ public boolean onTouchEvent(MotionEvent event) {
setSelection(0);
return false;
}
if (hasFocus() && showClearButton) {
if (hasFocus() && showClearButton && isEnabled()) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
if (insideClearButton(event)) {
Expand Down

0 comments on commit 7e0e045

Please sign in to comment.