Skip to content

Commit

Permalink
Add go to preference action, same actions list for both back key acti…
Browse files Browse the repository at this point in the history
…vations, for upstream #269
  • Loading branch information
liquiddandruff committed Jan 10, 2015
1 parent 70e5b50 commit 21e96ce
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
2 changes: 2 additions & 0 deletions assets/resources/application/en.xml
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,7 @@
</node>
<node name="backKeyAction" value="Back key action">
<node name="exit" value="Close FBReader"/>
<node name="goToPreferences" value="Go directly to your preferences"/>
<node name="goToPreviousBook" value="Go directly to your previously opened book"/>
<node name="goToLibrary" value="Go directly to your library"/>
<node name="goToNetworkLibrary" value="Go directly to your network library"/>
Expand All @@ -804,6 +805,7 @@
</node>
<node name="backKeyLongPressAction" value="Back key long press action">
<node name="exit" value="Close FBReader"/>
<node name="goToPreferences" value="Go directly to your preferences"/>
<node name="goToPreviousBook" value="Go directly to your previously opened book"/>
<node name="goToLibrary" value="Go directly to your library"/>
<node name="goToNetworkLibrary" value="Go directly to your network library"/>
Expand Down
1 change: 1 addition & 0 deletions src/org/geometerplus/android/fbreader/FBReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ public void run() {
myFBReaderApp.addAction(ActionCode.OPEN_VIDEO, new OpenVideoAction(this, myFBReaderApp));

myFBReaderApp.addAction(ActionCode.SHOW_CANCEL_MENU, new ShowCancelMenuAction(this, myFBReaderApp));
myFBReaderApp.addAction(ActionCode.GO_TO_PREFERENCES, new ShowPreferencesAction(this, myFBReaderApp));
myFBReaderApp.addAction(ActionCode.GO_TO_LIBRARY, new ShowLibraryAction(this, myFBReaderApp));
myFBReaderApp.addAction(ActionCode.GO_TO_NETWORK_LIBRARY, new ShowNetworkLibraryAction(this, myFBReaderApp));
myFBReaderApp.addAction(ActionCode.GO_TO_PREVIOUS_BOOK, new GoToPreviousBookAction(this, myFBReaderApp));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -716,27 +716,21 @@ protected void onDialogClosed(boolean result) {
cancelMenuScreen.addOption(cancelMenuHelper.ShowNetworkLibraryItemOption, "networkLibrary");
cancelMenuScreen.addOption(cancelMenuHelper.ShowPreviousBookItemOption, "previousBook");
cancelMenuScreen.addOption(cancelMenuHelper.ShowPositionItemsOption, "positions");
final String[] backKeyActions = {
final String[] backKeyAndBackKeyLongPressActions = {
ActionCode.SHOW_CANCEL_MENU,
ActionCode.GO_TO_PREFERENCES,
ActionCode.GO_TO_LIBRARY,
ActionCode.GO_TO_NETWORK_LIBRARY,
ActionCode.GO_TO_PREVIOUS_BOOK,
ActionCode.EXIT,
FBReaderApp.NoAction };
cancelMenuScreen.addPreference(new ZLStringChoicePreference(
this, cancelMenuScreen.Resource.getResource("backKeyAction"),
keyBindings.getOption(KeyEvent.KEYCODE_BACK, false), backKeyActions
keyBindings.getOption(KeyEvent.KEYCODE_BACK, false), backKeyAndBackKeyLongPressActions
));
final String[] backKeyLongPressActions = {
ActionCode.SHOW_CANCEL_MENU,
ActionCode.GO_TO_LIBRARY,
ActionCode.GO_TO_NETWORK_LIBRARY,
ActionCode.GO_TO_PREVIOUS_BOOK,
ActionCode.EXIT,
FBReaderApp.NoAction };
cancelMenuScreen.addPreference(new ZLStringChoicePreference(
this, cancelMenuScreen.Resource.getResource("backKeyLongPressAction"),
keyBindings.getOption(KeyEvent.KEYCODE_BACK, true), backKeyLongPressActions
keyBindings.getOption(KeyEvent.KEYCODE_BACK, true), backKeyAndBackKeyLongPressActions
));

final Screen tipsScreen = createPreferenceScreen("tips");
Expand Down
1 change: 1 addition & 0 deletions src/org/geometerplus/fbreader/fbreader/ActionCode.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public interface ActionCode {
String GO_BACK = "goBack";
String EXIT = "exit";
String SHOW_CANCEL_MENU = "cancelMenu";
String GO_TO_PREFERENCES = "goToPreferences";
String GO_TO_LIBRARY = "goToLibrary";
String GO_TO_NETWORK_LIBRARY = "goToNetworkLibrary";
String GO_TO_PREVIOUS_BOOK = "goToPreviousBook";
Expand Down

0 comments on commit 21e96ce

Please sign in to comment.