Don't invalidate view if setEnabled doesn't change the state.
Check the current enabled state before setting it, in case there's no change. Otherwise some apps are repeatedly redrawing buttons based on validation of some text field (like gmail or mms message bodies). Should slightly improve the performance of soft keyboard text entry.
This commit is contained in:
@@ -2983,6 +2983,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
|
||||
* @param enabled True if this view is enabled, false otherwise.
|
||||
*/
|
||||
public void setEnabled(boolean enabled) {
|
||||
if (enabled == isEnabled()) return;
|
||||
|
||||
setFlags(enabled ? ENABLED : DISABLED, ENABLED_MASK);
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user