From 879d82325cba0ea9318977ad86f8a53aab9b614a Mon Sep 17 00:00:00 2001 From: Marcel Dopita Date: Sat, 23 Mar 2013 11:43:27 +0100 Subject: [PATCH] added handling of volume keys in onKeyUp to suppress beeping --- src/org/fox/ttrss/OnlineActivity.java | 15 +++++++++++++++ src/org/fox/ttrss/offline/OfflineActivity.java | 15 +++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/src/org/fox/ttrss/OnlineActivity.java b/src/org/fox/ttrss/OnlineActivity.java index ef94131b..3c52fdf9 100644 --- a/src/org/fox/ttrss/OnlineActivity.java +++ b/src/org/fox/ttrss/OnlineActivity.java @@ -1198,7 +1198,22 @@ public class OnlineActivity extends CommonActivity { return super.onKeyDown(keyCode, event); } + + // Handle onKeyUp too to suppress beep + @Override + public boolean onKeyUp(int keyCode, KeyEvent event) { + if (m_prefs.getBoolean("use_volume_keys", false)) { + + switch (keyCode) { + case KeyEvent.KEYCODE_VOLUME_UP: + case KeyEvent.KEYCODE_VOLUME_DOWN: + return true; + } + } + return super.onKeyUp(keyCode, event); + } + @SuppressWarnings("unchecked") public void catchupFeed(final Feed feed) { Log.d(TAG, "catchupFeed=" + feed); diff --git a/src/org/fox/ttrss/offline/OfflineActivity.java b/src/org/fox/ttrss/offline/OfflineActivity.java index 41122e0f..78102c1a 100644 --- a/src/org/fox/ttrss/offline/OfflineActivity.java +++ b/src/org/fox/ttrss/offline/OfflineActivity.java @@ -520,6 +520,21 @@ public class OfflineActivity extends CommonActivity { return super.onKeyDown(keyCode, event); } + // Handle onKeyUp too to suppress beep + @Override + public boolean onKeyUp(int keyCode, KeyEvent event) { + if (m_prefs.getBoolean("use_volume_keys", false)) { + + switch (keyCode) { + case KeyEvent.KEYCODE_VOLUME_UP: + case KeyEvent.KEYCODE_VOLUME_DOWN: + return true; + } + } + + return super.onKeyUp(keyCode, event); + } + protected Cursor getFeedById(int feedId) { Cursor c = getReadableDb().query("feeds", null, BaseColumns._ID + "=?",