diff options
author | Andrew Gaul <[email protected]> | 2021-03-28 19:05:43 +0900 |
---|---|---|
committer | Andrew Gaul <[email protected]> | 2021-03-28 22:57:54 +0900 |
commit | d370e82d4b2a7bcd3e05e13ab66a91a3e2679f5d (patch) | |
tree | fb99d530161eeabfbc9cf012f1bc0a0d580aaa65 /org.fox.ttrss/src/main/java/org | |
parent | 6010d29d22d551a6fa9ded5baf0d590364e1381d (diff) |
Add some keyboard shortcuts
Handle left, right, escape, and unread keyboard shortcuts.
Diffstat (limited to 'org.fox.ttrss/src/main/java/org')
-rwxr-xr-x | org.fox.ttrss/src/main/java/org/fox/ttrss/OnlineActivity.java | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/OnlineActivity.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/OnlineActivity.java index 69a05b23..bac7042b 100755 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/OnlineActivity.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/OnlineActivity.java @@ -1323,8 +1323,36 @@ public class OnlineActivity extends CommonActivity { @Override public boolean onKeyDown(int keyCode, KeyEvent event) { + ArticlePager ap = (ArticlePager) getSupportFragmentManager().findFragmentByTag(FRAG_ARTICLE); + HeadlinesFragment hf = (HeadlinesFragment) getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES); + + switch (keyCode) { + case KeyEvent.KEYCODE_DPAD_LEFT: + if (ap != null && ap.isAdded()) { + ap.selectArticle(false); + return true; + } + break; + case KeyEvent.KEYCODE_DPAD_RIGHT: + if (ap != null && ap.isAdded()) { + ap.selectArticle(true); + return true; + } + break; + case KeyEvent.KEYCODE_ESCAPE: + moveTaskToBack(true); + return true; + case KeyEvent.KEYCODE_U: + if (ap != null && ap.getSelectedArticle() != null) { + Article a = ap.getSelectedArticle(); + a.unread = !a.unread; + saveArticleUnread(a); + if (hf != null) hf.notifyUpdated(); + } + return true; + } + if (m_prefs.getBoolean("use_volume_keys", false)) { - ArticlePager ap = (ArticlePager) getSupportFragmentManager().findFragmentByTag(FRAG_ARTICLE); if (ap != null && ap.isAdded()) { switch (keyCode) { |