mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
Change volume key navigation to always match left/right swipe.
This commit is contained in:
parent
87a88f9d82
commit
25ee53c874
4 changed files with 14 additions and 46 deletions
|
@ -25,9 +25,4 @@ public class GlobalSharedStoriesReading extends Reading {
|
|||
menu.removeItem(R.id.menu_reading_markunread);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean unreadSearchingSupported() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ import android.content.Loader;
|
|||
|
||||
import com.newsblur.R;
|
||||
import com.newsblur.database.MixedFeedsReadingAdapter;
|
||||
import com.newsblur.util.FeedUtils;
|
||||
import com.newsblur.util.UIUtils;
|
||||
|
||||
public class ReadStoriesReading extends Reading {
|
||||
|
@ -25,9 +24,4 @@ public class ReadStoriesReading extends Reading {
|
|||
public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
|
||||
super.onLoadFinished(loader, cursor);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean unreadSearchingSupported() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -771,44 +771,28 @@ 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)) {
|
||||
if (unreadSearchingSupported()) {
|
||||
overlayRight(overlayRight);
|
||||
} else {
|
||||
if (pager == null) return;
|
||||
int nextPosition = pager.getCurrentItem() + 1;
|
||||
if (nextPosition < readingAdapter.getCount()) {
|
||||
try {
|
||||
pager.setCurrentItem(nextPosition);
|
||||
} catch (Exception e) {
|
||||
// Just in case cursor changes.
|
||||
}
|
||||
if (pager == null) return;
|
||||
int nextPosition = pager.getCurrentItem() + 1;
|
||||
if (nextPosition < readingAdapter.getCount()) {
|
||||
try {
|
||||
pager.setCurrentItem(nextPosition);
|
||||
} catch (Exception e) {
|
||||
// Just in case cursor changes.
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (unreadSearchingSupported()) {
|
||||
overlayLeft(overlayLeft);
|
||||
} else {
|
||||
if (pager == null) return;
|
||||
int nextPosition = pager.getCurrentItem() - 1;
|
||||
if (nextPosition >= 0) {
|
||||
try {
|
||||
pager.setCurrentItem(nextPosition);
|
||||
} catch (Exception e) {
|
||||
// Just in case cursor changes.
|
||||
}
|
||||
if (pager == null) return;
|
||||
int nextPosition = pager.getCurrentItem() - 1;
|
||||
if (nextPosition >= 0) {
|
||||
try {
|
||||
pager.setCurrentItem(nextPosition);
|
||||
} catch (Exception e) {
|
||||
// Just in case cursor changes.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Global shared, saved and read stories don't support searching for unreads so we need to
|
||||
* fall back to swipe left/right behaviour.
|
||||
*/
|
||||
protected boolean unreadSearchingSupported() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyUp(int keyCode, KeyEvent event) {
|
||||
// Required to prevent the default sound playing when the volume key is pressed
|
||||
|
|
|
@ -27,9 +27,4 @@ public class SavedStoriesReading extends Reading {
|
|||
FeedUtils.dbHelper.markSavedReadingSession();
|
||||
super.onLoadFinished(loader, cursor);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean unreadSearchingSupported() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue