diff options
author | Adrian Roos <roosa@google.com> | 2015-10-19 23:26:47 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-10-19 23:26:47 +0000 |
commit | 9a345f31f23fc581f9ce501e854c821e865920ca (patch) | |
tree | 10bd2737db78b8d772dee4cbbff88df0fe4860f2 /packages/SystemUI/src/com/android/systemui/statusbar/policy | |
parent | 986d4b482da952cd07e329b3bd11c935edd7ec01 (diff) | |
parent | 3bab515b19da755e0e59c6be83fd92b3ac8d8ea3 (diff) | |
download | frameworks_base-9a345f31f23fc581f9ce501e854c821e865920ca.zip frameworks_base-9a345f31f23fc581f9ce501e854c821e865920ca.tar.gz frameworks_base-9a345f31f23fc581f9ce501e854c821e865920ca.tar.bz2 |
Merge "Reload content description of KeyButtonView" into mnc-dr-dev
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/statusbar/policy')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java index 4c99792..4d268ce 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java @@ -18,12 +18,14 @@ package com.android.systemui.statusbar.policy; import android.app.ActivityManager; import android.content.Context; +import android.content.res.Configuration; import android.content.res.TypedArray; import android.hardware.input.InputManager; import android.media.AudioManager; import android.os.Bundle; import android.os.SystemClock; import android.util.AttributeSet; +import android.util.TypedValue; import android.view.HapticFeedbackConstants; import android.view.InputDevice; import android.view.KeyCharacterMap; @@ -43,6 +45,7 @@ import static android.view.accessibility.AccessibilityNodeInfo.ACTION_LONG_CLICK public class KeyButtonView extends ImageView { + private int mContentDescriptionRes; private long mDownTime; private int mCode; private int mTouchSlop; @@ -79,8 +82,14 @@ public class KeyButtonView extends ImageView { mSupportsLongpress = a.getBoolean(R.styleable.KeyButtonView_keyRepeat, true); + TypedValue value = new TypedValue(); + if (a.getValue(R.styleable.KeyButtonView_android_contentDescription, value)) { + mContentDescriptionRes = value.resourceId; + } + a.recycle(); + setClickable(true); mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop(); mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); @@ -88,6 +97,15 @@ public class KeyButtonView extends ImageView { } @Override + protected void onConfigurationChanged(Configuration newConfig) { + super.onConfigurationChanged(newConfig); + + if (mContentDescriptionRes != 0) { + setContentDescription(mContext.getString(mContentDescriptionRes)); + } + } + + @Override public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfo(info); if (mCode != 0) { |