summaryrefslogtreecommitdiffstats
path: root/core/java/android/widget
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2012-03-08 11:14:07 -0800
committerRomain Guy <romainguy@google.com>2012-03-08 15:05:12 -0800
commitbb9908b828a8cfd5965553be66faa6af89973697 (patch)
tree33ab74a9cb8ad69058cece5ae83d4b82f7b51633 /core/java/android/widget
parent3bef5e9f3aa90465ee3ab66ef33d7a88d1b0c5c1 (diff)
downloadframeworks_base-bb9908b828a8cfd5965553be66faa6af89973697.zip
frameworks_base-bb9908b828a8cfd5965553be66faa6af89973697.tar.gz
frameworks_base-bb9908b828a8cfd5965553be66faa6af89973697.tar.bz2
Dispatch screen state change events to Views
Bug #6120957 Using this new callback, views can interrupt and resume their animations or other periodic tasks based on the current state of the display. Change-Id: I398f4abd421e9c5f207107bf1009a7b92cf45daa
Diffstat (limited to 'core/java/android/widget')
-rw-r--r--core/java/android/widget/TextView.java30
1 files changed, 30 insertions, 0 deletions
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 47e10cc..6ac889a 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -4266,6 +4266,12 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
}
@Override
+ public void onScreenStateChanged(int screenState) {
+ super.onScreenStateChanged(screenState);
+ if (mEditor != null) getEditor().onScreenStateChanged(screenState);
+ }
+
+ @Override
protected boolean isPaddingOffsetRequired() {
return mShadowRadius != 0 || mDrawables != null;
}
@@ -11386,6 +11392,30 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
hideControllers();
}
+ void onScreenStateChanged(int screenState) {
+ switch (screenState) {
+ case SCREEN_STATE_ON:
+ resumeBlink();
+ break;
+ case SCREEN_STATE_OFF:
+ suspendBlink();
+ break;
+ }
+ }
+
+ private void suspendBlink() {
+ if (mBlink != null) {
+ mBlink.cancel();
+ }
+ }
+
+ private void resumeBlink() {
+ if (mBlink != null) {
+ mBlink.uncancel();
+ makeBlink();
+ }
+ }
+
void adjustInputType(boolean password, boolean passwordInputType,
boolean webPasswordInputType, boolean numberPasswordInputType) {
// mInputType has been set from inputType, possibly modified by mInputMethod.