mirror of
https://github.com/viq/NewsBlur.git
synced 2025-09-18 21:43:31 +00:00
Fix volume key navigation for global shared/saved/read stories (#715)
This commit is contained in:
parent
ad24d03a85
commit
b86fa09cfd
4 changed files with 37 additions and 2 deletions
|
@ -25,4 +25,9 @@ public class GlobalSharedStoriesReading extends Reading {
|
|||
menu.removeItem(R.id.menu_reading_markunread);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean overlayNavigationSupported() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,4 +26,8 @@ public class ReadStoriesReading extends Reading {
|
|||
super.onLoadFinished(loader, cursor);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean overlayNavigationSupported() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -771,12 +771,34 @@ public abstract class Reading extends NbActivity implements OnPageChangeListener
|
|||
private void processVolumeKeyNavigationEvent(int keyCode) {
|
||||
if ((keyCode == KeyEvent.KEYCODE_VOLUME_DOWN && volumeKeyNavigation == VolumeKeyNavigation.DOWN_NEXT) ||
|
||||
(keyCode == KeyEvent.KEYCODE_VOLUME_UP && volumeKeyNavigation == VolumeKeyNavigation.UP_NEXT)) {
|
||||
overlayRight(overlayRight);
|
||||
if (overlayNavigationSupported()) {
|
||||
overlayRight(overlayRight);
|
||||
} else {
|
||||
int nextPosition = pager.getCurrentItem() + 1;
|
||||
if (nextPosition < readingAdapter.getCount()) {
|
||||
pager.setCurrentItem(nextPosition);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
overlayLeft(overlayLeft);
|
||||
if (overlayNavigationSupported()) {
|
||||
overlayLeft(overlayLeft);
|
||||
} else {
|
||||
int nextPosition = pager.getCurrentItem() - 1;
|
||||
if (nextPosition >= 0) {
|
||||
pager.setCurrentItem(nextPosition);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Global shared, saved and read stories don't have overlays enabled for
|
||||
* navigating between stories so we need to fall back to swipe left/right behaviour.
|
||||
*/
|
||||
protected boolean overlayNavigationSupported() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyUp(int keyCode, KeyEvent event) {
|
||||
// Required to prevent the default sound playing when the volume key is pressed
|
||||
|
|
|
@ -28,4 +28,8 @@ public class SavedStoriesReading extends Reading {
|
|||
super.onLoadFinished(loader, cursor);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean overlayNavigationSupported() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue