Merge pull request #12 from moneytoo/volumekeys

Added handling of volume keys in onKeyUp to suppress beeping
This commit is contained in:
Andrew Dolgov 2013-03-24 01:53:03 -07:00
commit cb39f9aa25
2 changed files with 30 additions and 0 deletions

View File

@ -1198,7 +1198,22 @@ public class OnlineActivity extends CommonActivity {
return super.onKeyDown(keyCode, event); 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") @SuppressWarnings("unchecked")
public void catchupFeed(final Feed feed) { public void catchupFeed(final Feed feed) {
Log.d(TAG, "catchupFeed=" + feed); Log.d(TAG, "catchupFeed=" + feed);

View File

@ -520,6 +520,21 @@ public class OfflineActivity extends CommonActivity {
return super.onKeyDown(keyCode, event); 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) { protected Cursor getFeedById(int feedId) {
Cursor c = getReadableDb().query("feeds", null, Cursor c = getReadableDb().query("feeds", null,
BaseColumns._ID + "=?", BaseColumns._ID + "=?",