Loading packages/SystemUI/res/layout/navigation_bar.xml +2 −0 Original line number Diff line number Diff line Loading @@ -66,6 +66,7 @@ android:layout_height="match_parent" android:src="@drawable/ic_sysbar_home" systemui:keyCode="3" systemui:keyRepeat="false" android:layout_weight="0" systemui:glowBackground="@drawable/ic_sysbar_highlight" android:contentDescription="@string/accessibility_home" Loading Loading @@ -148,6 +149,7 @@ android:layout_width="match_parent" android:src="@drawable/ic_sysbar_home_land" systemui:keyCode="3" systemui:keyRepeat="false" android:layout_weight="0" android:contentDescription="@string/accessibility_home" systemui:glowBackground="@drawable/ic_sysbar_highlight_land" Loading packages/SystemUI/res/values/attrs.xml +4 −0 Original line number Diff line number Diff line Loading @@ -16,7 +16,11 @@ <resources> <declare-styleable name="KeyButtonView"> <!-- key code to send when pressed; if absent or 0, no key is sent --> <attr name="keyCode" format="integer" /> <!-- does this button generate longpress / repeat events? --> <attr name="keyRepeat" format="boolean" /> <!-- drawable to use for a swelling, glowing background on press --> <attr name="glowBackground" format="reference" /> </declare-styleable> <declare-styleable name="ToggleSlider"> Loading packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java +21 −8 Original line number Diff line number Diff line Loading @@ -57,11 +57,12 @@ public class KeyButtonView extends ImageView { int mTouchSlop; Drawable mGlowBG; float mGlowAlpha = 0f, mGlowScale = 1f, mDrawingAlpha = 1f; boolean mSupportsLongpress = true; Runnable mCheckLongPress = new Runnable() { public void run() { if (isPressed()) { // Slog.d("KeyButtonView", "longpressed: " + this); if (mCode != 0) { mRepeat++; sendEvent(KeyEvent.ACTION_DOWN, Loading Loading @@ -90,6 +91,8 @@ public class KeyButtonView extends ImageView { mCode = a.getInteger(R.styleable.KeyButtonView_keyCode, 0); mSupportsLongpress = a.getBoolean(R.styleable.KeyButtonView_keyRepeat, true); mGlowBG = a.getDrawable(R.styleable.KeyButtonView_glowBackground); if (mGlowBG != null) { mDrawingAlpha = 0.5f; Loading Loading @@ -207,11 +210,19 @@ public class KeyButtonView extends ImageView { mDownTime = SystemClock.uptimeMillis(); mRepeat = 0; mSending = true; setPressed(true); sendEvent(KeyEvent.ACTION_DOWN, KeyEvent.FLAG_FROM_SYSTEM | KeyEvent.FLAG_VIRTUAL_HARD_KEY, mDownTime); setPressed(true); if (mSupportsLongpress) { removeCallbacks(mCheckLongPress); postDelayed(mCheckLongPress, ViewConfiguration.getLongPressTimeout()); } else { mSending = false; sendEvent(KeyEvent.ACTION_UP, KeyEvent.FLAG_FROM_SYSTEM | KeyEvent.FLAG_VIRTUAL_HARD_KEY, mDownTime); sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_CLICKED); playSoundEffect(SoundEffectConstants.CLICK); } break; case MotionEvent.ACTION_MOVE: if (mSending) { Loading @@ -230,8 +241,10 @@ public class KeyButtonView extends ImageView { sendEvent(KeyEvent.ACTION_UP, KeyEvent.FLAG_FROM_SYSTEM | KeyEvent.FLAG_VIRTUAL_HARD_KEY | KeyEvent.FLAG_CANCELED); if (mSupportsLongpress) { removeCallbacks(mCheckLongPress); } } break; case MotionEvent.ACTION_UP: final boolean doIt = isPressed(); Loading @@ -239,15 +252,15 @@ public class KeyButtonView extends ImageView { if (mSending) { mSending = false; final int flags = KeyEvent.FLAG_FROM_SYSTEM | KeyEvent.FLAG_VIRTUAL_HARD_KEY; if (mSupportsLongpress) { removeCallbacks(mCheckLongPress); } if (mCode != 0) { if (doIt) { sendEvent(KeyEvent.ACTION_UP, flags); sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_CLICKED); playSoundEffect(SoundEffectConstants.CLICK); } else { sendEvent(KeyEvent.ACTION_UP, flags | KeyEvent.FLAG_CANCELED); } } else { // no key code, just a regular ImageView Loading Loading
packages/SystemUI/res/layout/navigation_bar.xml +2 −0 Original line number Diff line number Diff line Loading @@ -66,6 +66,7 @@ android:layout_height="match_parent" android:src="@drawable/ic_sysbar_home" systemui:keyCode="3" systemui:keyRepeat="false" android:layout_weight="0" systemui:glowBackground="@drawable/ic_sysbar_highlight" android:contentDescription="@string/accessibility_home" Loading Loading @@ -148,6 +149,7 @@ android:layout_width="match_parent" android:src="@drawable/ic_sysbar_home_land" systemui:keyCode="3" systemui:keyRepeat="false" android:layout_weight="0" android:contentDescription="@string/accessibility_home" systemui:glowBackground="@drawable/ic_sysbar_highlight_land" Loading
packages/SystemUI/res/values/attrs.xml +4 −0 Original line number Diff line number Diff line Loading @@ -16,7 +16,11 @@ <resources> <declare-styleable name="KeyButtonView"> <!-- key code to send when pressed; if absent or 0, no key is sent --> <attr name="keyCode" format="integer" /> <!-- does this button generate longpress / repeat events? --> <attr name="keyRepeat" format="boolean" /> <!-- drawable to use for a swelling, glowing background on press --> <attr name="glowBackground" format="reference" /> </declare-styleable> <declare-styleable name="ToggleSlider"> Loading
packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java +21 −8 Original line number Diff line number Diff line Loading @@ -57,11 +57,12 @@ public class KeyButtonView extends ImageView { int mTouchSlop; Drawable mGlowBG; float mGlowAlpha = 0f, mGlowScale = 1f, mDrawingAlpha = 1f; boolean mSupportsLongpress = true; Runnable mCheckLongPress = new Runnable() { public void run() { if (isPressed()) { // Slog.d("KeyButtonView", "longpressed: " + this); if (mCode != 0) { mRepeat++; sendEvent(KeyEvent.ACTION_DOWN, Loading Loading @@ -90,6 +91,8 @@ public class KeyButtonView extends ImageView { mCode = a.getInteger(R.styleable.KeyButtonView_keyCode, 0); mSupportsLongpress = a.getBoolean(R.styleable.KeyButtonView_keyRepeat, true); mGlowBG = a.getDrawable(R.styleable.KeyButtonView_glowBackground); if (mGlowBG != null) { mDrawingAlpha = 0.5f; Loading Loading @@ -207,11 +210,19 @@ public class KeyButtonView extends ImageView { mDownTime = SystemClock.uptimeMillis(); mRepeat = 0; mSending = true; setPressed(true); sendEvent(KeyEvent.ACTION_DOWN, KeyEvent.FLAG_FROM_SYSTEM | KeyEvent.FLAG_VIRTUAL_HARD_KEY, mDownTime); setPressed(true); if (mSupportsLongpress) { removeCallbacks(mCheckLongPress); postDelayed(mCheckLongPress, ViewConfiguration.getLongPressTimeout()); } else { mSending = false; sendEvent(KeyEvent.ACTION_UP, KeyEvent.FLAG_FROM_SYSTEM | KeyEvent.FLAG_VIRTUAL_HARD_KEY, mDownTime); sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_CLICKED); playSoundEffect(SoundEffectConstants.CLICK); } break; case MotionEvent.ACTION_MOVE: if (mSending) { Loading @@ -230,8 +241,10 @@ public class KeyButtonView extends ImageView { sendEvent(KeyEvent.ACTION_UP, KeyEvent.FLAG_FROM_SYSTEM | KeyEvent.FLAG_VIRTUAL_HARD_KEY | KeyEvent.FLAG_CANCELED); if (mSupportsLongpress) { removeCallbacks(mCheckLongPress); } } break; case MotionEvent.ACTION_UP: final boolean doIt = isPressed(); Loading @@ -239,15 +252,15 @@ public class KeyButtonView extends ImageView { if (mSending) { mSending = false; final int flags = KeyEvent.FLAG_FROM_SYSTEM | KeyEvent.FLAG_VIRTUAL_HARD_KEY; if (mSupportsLongpress) { removeCallbacks(mCheckLongPress); } if (mCode != 0) { if (doIt) { sendEvent(KeyEvent.ACTION_UP, flags); sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_CLICKED); playSoundEffect(SoundEffectConstants.CLICK); } else { sendEvent(KeyEvent.ACTION_UP, flags | KeyEvent.FLAG_CANCELED); } } else { // no key code, just a regular ImageView Loading