1
0
Fork 0
mirror of https://github.com/geometer/FBReaderJ.git synced 2025-10-04 18:29:23 +02:00

'Cancel menu' preferences section

This commit is contained in:
Nikolay Pultsin 2011-03-09 23:19:52 +00:00
parent 3911ffc09b
commit d073898d55
20 changed files with 223 additions and 52 deletions

View file

@ -9,6 +9,7 @@
* Periodical update of custom links information has been added
* Epub rendering issues (like unexpected paragraph ends) were fixed
* Multi-body fb2 file processing has been fixed
* 'Cancel menu' preferences section
===== 0.99.13 (Feb 13, 2011) =====
* Fixed book/position forgetting bug

View file

@ -527,6 +527,17 @@
<node name="summaryOff" value="Navigace klávesami prochází pouze hypertextové odkazy"/>
</node>
</node>
<node name="cancelMenu" value="Cancel menu" toBeTranslated="true">
<node name="summary" value="Back button action list" toBeTranslated="true"/>
<node name="previousBook" value="Previous book" toBeTranslated="true">
<node name="summaryOn" value="Show 'return to previous book' item" toBeTranslated="true"/>
<node name="summaryOff" value="Don't show 'return to previous book' item" toBeTranslated="true"/>
</node>
<node name="positions" value="Last 3 positions" toBeTranslated="true">
<node name="summaryOn" value="Show items for last 3 positions in the book" toBeTranslated="true"/>
<node name="summaryOff" value="Don't show items for last 3 positions in the book" toBeTranslated="true"/>
</node>
</node>
</node>
<node name="OptionsDialog">
<node name="tab">

View file

@ -528,6 +528,17 @@
<node name="summaryOff" value="Key navigation visits hyperlinks only" toBeTranslated="true"/>
</node>
</node>
<node name="cancelMenu" value="Cancel menu" toBeTranslated="true">
<node name="summary" value="Back button action list" toBeTranslated="true"/>
<node name="previousBook" value="Previous book" toBeTranslated="true">
<node name="summaryOn" value="Show 'return to previous book' item" toBeTranslated="true"/>
<node name="summaryOff" value="Don't show 'return to previous book' item" toBeTranslated="true"/>
</node>
<node name="positions" value="Last 3 positions" toBeTranslated="true">
<node name="summaryOn" value="Show items for last 3 positions in the book" toBeTranslated="true"/>
<node name="summaryOff" value="Don't show items for last 3 positions in the book" toBeTranslated="true"/>
</node>
</node>
</node>
<node name="OptionsDialog">
<node name="tab">

View file

@ -530,6 +530,17 @@
<node name="summaryOff" value="Key navigation visits hyperlinks only"/>
</node>
</node>
<node name="cancelMenu" value="Cancel menu">
<node name="summary" value="Back button action list"/>
<node name="previousBook" value="Previous book">
<node name="summaryOn" value="Show 'return to previous book' item"/>
<node name="summaryOff" value="Don't show 'return to previous book' item"/>
</node>
<node name="positions" value="Last 3 positions">
<node name="summaryOn" value="Show items for last 3 positions in the book"/>
<node name="summaryOff" value="Don't show items for last 3 positions in the book"/>
</node>
</node>
</node>
<node name="OptionsDialog">
<node name="tab">

View file

@ -530,6 +530,17 @@
<node name="summaryOff" value="La navigation par touches visite les liens hypertexts uniquement"/>
</node>
</node>
<node name="cancelMenu" value="Cancel menu" toBeTranslated="true">
<node name="summary" value="Back button action list" toBeTranslated="true"/>
<node name="previousBook" value="Previous book" toBeTranslated="true">
<node name="summaryOn" value="Show 'return to previous book' item" toBeTranslated="true"/>
<node name="summaryOff" value="Don't show 'return to previous book' item" toBeTranslated="true"/>
</node>
<node name="positions" value="Last 3 positions" toBeTranslated="true">
<node name="summaryOn" value="Show items for last 3 positions in the book" toBeTranslated="true"/>
<node name="summaryOff" value="Don't show items for last 3 positions in the book" toBeTranslated="true"/>
</node>
</node>
</node>
<node name="OptionsDialog">
<node name="tab">

View file

@ -527,6 +527,17 @@
<node name="summaryOff" value="A tecla de navegación percorre só as ligazóns"/>
</node>
</node>
<node name="cancelMenu" value="Cancel menu" toBeTranslated="true">
<node name="summary" value="Back button action list" toBeTranslated="true"/>
<node name="previousBook" value="Previous book" toBeTranslated="true">
<node name="summaryOn" value="Show 'return to previous book' item" toBeTranslated="true"/>
<node name="summaryOff" value="Don't show 'return to previous book' item" toBeTranslated="true"/>
</node>
<node name="positions" value="Last 3 positions" toBeTranslated="true">
<node name="summaryOn" value="Show items for last 3 positions in the book" toBeTranslated="true"/>
<node name="summaryOff" value="Don't show items for last 3 positions in the book" toBeTranslated="true"/>
</node>
</node>
</node>
<node name="OptionsDialog">
<node name="tab">

View file

@ -527,6 +527,17 @@
<node name="summaryOff" value="A gombnyomásos navigáció linkről linkre ugrik"/>
</node>
</node>
<node name="cancelMenu" value="Cancel menu" toBeTranslated="true">
<node name="summary" value="Back button action list" toBeTranslated="true"/>
<node name="previousBook" value="Previous book" toBeTranslated="true">
<node name="summaryOn" value="Show 'return to previous book' item" toBeTranslated="true"/>
<node name="summaryOff" value="Don't show 'return to previous book' item" toBeTranslated="true"/>
</node>
<node name="positions" value="Last 3 positions" toBeTranslated="true">
<node name="summaryOn" value="Show items for last 3 positions in the book" toBeTranslated="true"/>
<node name="summaryOff" value="Don't show items for last 3 positions in the book" toBeTranslated="true"/>
</node>
</node>
</node>
<node name="OptionsDialog">
<node name="tab">

View file

@ -527,6 +527,17 @@
<node name="summaryOff" value="Key navigation visits hyperlinks only" toBeTranslated="true"/>
</node>
</node>
<node name="cancelMenu" value="Cancel menu" toBeTranslated="true">
<node name="summary" value="Back button action list" toBeTranslated="true"/>
<node name="previousBook" value="Previous book" toBeTranslated="true">
<node name="summaryOn" value="Show 'return to previous book' item" toBeTranslated="true"/>
<node name="summaryOff" value="Don't show 'return to previous book' item" toBeTranslated="true"/>
</node>
<node name="positions" value="Last 3 positions" toBeTranslated="true">
<node name="summaryOn" value="Show items for last 3 positions in the book" toBeTranslated="true"/>
<node name="summaryOff" value="Don't show items for last 3 positions in the book" toBeTranslated="true"/>
</node>
</node>
</node>
<node name="OptionsDialog">
<node name="tab">

View file

@ -527,6 +527,17 @@
<node name="summaryOff" value="Key navigation visits hyperlinks only" toBeTranslated="true"/>
</node>
</node>
<node name="cancelMenu" value="Cancel menu" toBeTranslated="true">
<node name="summary" value="Back button action list" toBeTranslated="true"/>
<node name="previousBook" value="Previous book" toBeTranslated="true">
<node name="summaryOn" value="Show 'return to previous book' item" toBeTranslated="true"/>
<node name="summaryOff" value="Don't show 'return to previous book' item" toBeTranslated="true"/>
</node>
<node name="positions" value="Last 3 positions" toBeTranslated="true">
<node name="summaryOn" value="Show items for last 3 positions in the book" toBeTranslated="true"/>
<node name="summaryOff" value="Don't show items for last 3 positions in the book" toBeTranslated="true"/>
</node>
</node>
</node>
<node name="OptionsDialog">
<node name="tab">

View file

@ -526,6 +526,17 @@
<node name="summaryOff" value="При перемещении с помощью кнопок помечать только гиперссылки"/>
</node>
</node>
<node name="cancelMenu" value="Меню выхода из программы">
<node name="summary" value="Список действий при нажатии на кнопку 'Назад'"/>
<node name="previousBook" value="Предыдущая книга">
<node name="summaryOn" value="Показать пункт меню для возврата к предыдущей книге"/>
<node name="summaryOff" value="Не нужна возможность возврата к предыдущей книге"/>
</node>
<node name="positions" value="Возврат по ссылкам">
<node name="summaryOn" value="Показывать пункты меню для последних 3 позиций в книге"/>
<node name="summaryOff" value="Не нужна возможность возврата по ссылкам"/>
</node>
</node>
</node>
<node name="OptionsDialog">
<node name="tab">

View file

@ -527,6 +527,17 @@
<node name="summaryOff" value="ตัวเลือกคำเลือกได้เฉพาะลิ้งค์ข้อความ"/>
</node>
</node>
<node name="cancelMenu" value="Cancel menu" toBeTranslated="true">
<node name="summary" value="Back button action list" toBeTranslated="true"/>
<node name="previousBook" value="Previous book" toBeTranslated="true">
<node name="summaryOn" value="Show 'return to previous book' item" toBeTranslated="true"/>
<node name="summaryOff" value="Don't show 'return to previous book' item" toBeTranslated="true"/>
</node>
<node name="positions" value="Last 3 positions" toBeTranslated="true">
<node name="summaryOn" value="Show items for last 3 positions in the book" toBeTranslated="true"/>
<node name="summaryOff" value="Don't show items for last 3 positions in the book" toBeTranslated="true"/>
</node>
</node>
</node>
<node name="OptionsDialog">
<node name="tab">

View file

@ -527,6 +527,17 @@
<node name="summaryOff" value="Key navigation visits hyperlinks only" toBeTranslated="true"/>
</node>
</node>
<node name="cancelMenu" value="Cancel menu" toBeTranslated="true">
<node name="summary" value="Back button action list" toBeTranslated="true"/>
<node name="previousBook" value="Previous book" toBeTranslated="true">
<node name="summaryOn" value="Show 'return to previous book' item" toBeTranslated="true"/>
<node name="summaryOff" value="Don't show 'return to previous book' item" toBeTranslated="true"/>
</node>
<node name="positions" value="Last 3 positions" toBeTranslated="true">
<node name="summaryOn" value="Show items for last 3 positions in the book" toBeTranslated="true"/>
<node name="summaryOff" value="Don't show items for last 3 positions in the book" toBeTranslated="true"/>
</node>
</node>
</node>
<node name="OptionsDialog">
<node name="tab">

View file

@ -527,6 +527,17 @@
<node name="summaryOff" value="Phím điều hướng chỉ tác động lên siêu liên kết"/>
</node>
</node>
<node name="cancelMenu" value="Cancel menu" toBeTranslated="true">
<node name="summary" value="Back button action list" toBeTranslated="true"/>
<node name="previousBook" value="Previous book" toBeTranslated="true">
<node name="summaryOn" value="Show 'return to previous book' item" toBeTranslated="true"/>
<node name="summaryOff" value="Don't show 'return to previous book' item" toBeTranslated="true"/>
</node>
<node name="positions" value="Last 3 positions" toBeTranslated="true">
<node name="summaryOn" value="Show items for last 3 positions in the book" toBeTranslated="true"/>
<node name="summaryOff" value="Don't show items for last 3 positions in the book" toBeTranslated="true"/>
</node>
</node>
</node>
<node name="OptionsDialog">
<node name="tab">

View file

@ -527,6 +527,17 @@
<node name="summaryOff" value="导航键仅访问超链接词句"/>
</node>
</node>
<node name="cancelMenu" value="Cancel menu" toBeTranslated="true">
<node name="summary" value="Back button action list" toBeTranslated="true"/>
<node name="previousBook" value="Previous book" toBeTranslated="true">
<node name="summaryOn" value="Show 'return to previous book' item" toBeTranslated="true"/>
<node name="summaryOff" value="Don't show 'return to previous book' item" toBeTranslated="true"/>
</node>
<node name="positions" value="Last 3 positions" toBeTranslated="true">
<node name="summaryOn" value="Show items for last 3 positions in the book" toBeTranslated="true"/>
<node name="summaryOff" value="Don't show items for last 3 positions in the book" toBeTranslated="true"/>
</node>
</node>
</node>
<node name="OptionsDialog">
<node name="tab">

View file

@ -237,11 +237,17 @@ class NetworkBookActions extends NetworkTreeActions {
}
static boolean runActionStatic(Activity activity, NetworkBookTree tree, int actionCode) {
final NetworkBookItem book = tree.Book;
switch (actionCode) {
case SHOW_BOOK_ACTIVITY_ITEM_ID:
Util.openTree(activity, tree);
return true;
default:
return runActionStatic(activity, tree.Book, actionCode);
}
}
static boolean runActionStatic(Activity activity, NetworkBookItem book, int actionCode) {
switch (actionCode) {
case DOWNLOAD_BOOK_ITEM_ID:
doDownloadBook(activity, book, false);
return true;

View file

@ -48,7 +48,7 @@ import org.geometerplus.fbreader.network.NetworkBookItem;
import org.geometerplus.fbreader.network.tree.NetworkBookTree;
public class NetworkBookInfoActivity extends Activity implements NetworkView.EventListener {
private NetworkBookTree myTree;
private NetworkBookItem myBook;
private View myMainView;
private final ZLResource myResource = ZLResource.resource("networkBookView");
@ -58,6 +58,15 @@ public class NetworkBookInfoActivity extends Activity implements NetworkView.Eve
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
myMainView = getLayoutInflater().inflate(R.layout.network_book, null, false);
setContentView(myMainView);
myMainView.setOnCreateContextMenuListener(this);
}
@Override
protected void onResume() {
super.onResume();
if (!NetworkView.Instance().isInitialized()) {
if (NetworkInitializer.Instance == null) {
new NetworkInitializer(this);
@ -65,15 +74,15 @@ public class NetworkBookInfoActivity extends Activity implements NetworkView.Eve
} else {
NetworkInitializer.Instance.setActivity(this);
}
return;
}
if (myBook == null) {
final NetworkTree tree = Util.getTreeFromIntent(getIntent());
if (!(tree instanceof NetworkBookTree)) {
finish();
return;
}
myTree = (NetworkBookTree)tree;
myBook = ((NetworkBookTree)tree).Book;
myConnection = new BookDownloaderServiceConnection();
bindService(
@ -82,16 +91,14 @@ public class NetworkBookInfoActivity extends Activity implements NetworkView.Eve
BIND_AUTO_CREATE
);
setTitle(myTree.Book.Title);
myMainView = getLayoutInflater().inflate(R.layout.network_book, null, false);
setContentView(myMainView);
myMainView.setOnCreateContextMenuListener(this);
setTitle(myBook.Title);
setupDescription();
setupInfo();
setupCover();
setupButtons();
}
}
View getMainView() {
return myMainView;
@ -119,19 +126,19 @@ public class NetworkBookInfoActivity extends Activity implements NetworkView.Eve
@Override
public void onCreateContextMenu(ContextMenu menu, View view, ContextMenu.ContextMenuInfo menuInfo) {
NetworkView.Instance().getTopUpActions().buildContextMenu(this, menu, myTree.Book.Link);
NetworkView.Instance().getTopUpActions().buildContextMenu(this, menu, myBook.Link);
}
@Override
public boolean onContextItemSelected(MenuItem item) {
RefillAccountActions.runAction(this, myTree.Book.Link, item.getItemId());
RefillAccountActions.runAction(this, myBook.Link, item.getItemId());
return true;
}
private final void setupDescription() {
setTextFromResource(R.id.network_book_description_title, "description");
String description = myTree.Book.Summary;
String description = myBook.Summary;
if (description == null) {
description = myResource.getResource("noDescription").getValue();
}
@ -150,8 +157,6 @@ public class NetworkBookInfoActivity extends Activity implements NetworkView.Eve
}
private void setupInfo() {
final NetworkBookItem book = myTree.Book;
setTextFromResource(R.id.network_book_info_title, "bookInfo");
setPairLabelTextFromResource(R.id.network_book_title, "title");
@ -161,12 +166,12 @@ public class NetworkBookInfoActivity extends Activity implements NetworkView.Eve
setPairLabelTextFromResource(R.id.network_book_tags, "tags");
setPairLabelTextFromResource(R.id.network_book_catalog, "catalog");
setPairValueText(R.id.network_book_title, book.Title);
setPairValueText(R.id.network_book_title, myBook.Title);
if (book.Authors.size() > 0) {
if (myBook.Authors.size() > 0) {
findViewById(R.id.network_book_authors).setVisibility(View.VISIBLE);
final StringBuilder authorsText = new StringBuilder();
for (NetworkBookItem.AuthorData author : book.Authors) {
for (NetworkBookItem.AuthorData author : myBook.Authors) {
if (authorsText.length() > 0) {
authorsText.append(", ");
}
@ -177,11 +182,11 @@ public class NetworkBookInfoActivity extends Activity implements NetworkView.Eve
findViewById(R.id.network_book_authors).setVisibility(View.GONE);
}
if (book.SeriesTitle != null) {
if (myBook.SeriesTitle != null) {
findViewById(R.id.network_book_series_title).setVisibility(View.VISIBLE);
setPairValueText(R.id.network_book_series_title, book.SeriesTitle);
if (book.IndexInSeries > 0) {
setPairValueText(R.id.network_book_series_index, String.valueOf(book.IndexInSeries));
setPairValueText(R.id.network_book_series_title, myBook.SeriesTitle);
if (myBook.IndexInSeries > 0) {
setPairValueText(R.id.network_book_series_index, String.valueOf(myBook.IndexInSeries));
findViewById(R.id.network_book_series_index).setVisibility(View.VISIBLE);
} else {
findViewById(R.id.network_book_series_index).setVisibility(View.GONE);
@ -191,10 +196,10 @@ public class NetworkBookInfoActivity extends Activity implements NetworkView.Eve
findViewById(R.id.network_book_series_index).setVisibility(View.GONE);
}
if (book.Tags.size() > 0) {
if (myBook.Tags.size() > 0) {
findViewById(R.id.network_book_tags).setVisibility(View.VISIBLE);
final StringBuilder tagsText = new StringBuilder();
for (String tag : book.Tags) {
for (String tag : myBook.Tags) {
if (tagsText.length() > 0) {
tagsText.append(", ");
}
@ -205,7 +210,7 @@ public class NetworkBookInfoActivity extends Activity implements NetworkView.Eve
findViewById(R.id.network_book_tags).setVisibility(View.GONE);
}
setPairValueText(R.id.network_book_catalog, book.Link.getTitle());
setPairValueText(R.id.network_book_catalog, myBook.Link.getTitle());
}
private final void setupCover() {
@ -218,7 +223,7 @@ public class NetworkBookInfoActivity extends Activity implements NetworkView.Eve
final int maxHeight = metrics.heightPixels * 2 / 3;
final int maxWidth = maxHeight * 2 / 3;
Bitmap coverBitmap = null;
final ZLImage cover = NetworkTree.createCover(myTree.Book);
final ZLImage cover = NetworkTree.createCover(myBook);
if (cover != null) {
ZLAndroidImageData data = null;
final ZLAndroidImageManager mgr = (ZLAndroidImageManager)ZLAndroidImageManager.Instance();
@ -262,7 +267,7 @@ public class NetworkBookInfoActivity extends Activity implements NetworkView.Eve
R.id.network_book_button2,
R.id.network_book_button3,
};
final Set<NetworkBookActions.Action> actions = NetworkBookActions.getContextMenuActions(myTree.Book, myConnection);
final Set<NetworkBookActions.Action> actions = NetworkBookActions.getContextMenuActions(myBook, myConnection);
final boolean skipSecondButton =
actions.size() < buttons.length &&
@ -289,7 +294,7 @@ public class NetworkBookInfoActivity extends Activity implements NetworkView.Eve
button.setVisibility(View.VISIBLE);
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
NetworkBookActions.runActionStatic(NetworkBookInfoActivity.this, myTree, a.Id);
NetworkBookActions.runActionStatic(NetworkBookInfoActivity.this, myBook, a.Id);
NetworkBookInfoActivity.this.updateView();
}
});

View file

@ -378,5 +378,9 @@ public class PreferenceActivity extends ZLPreferenceActivity {
"navigateOverAllWords"
));
dictionaryScreen.addOption(fbReader.DictionaryTappingActionOption, "tappingAction");
final Screen cancelMenuScreen = createPreferenceScreen("cancelMenu");
cancelMenuScreen.addOption(fbReader.ShowPreviousBookInCancelMenuOption, "previousBook");
cancelMenuScreen.addOption(fbReader.ShowPositionsInCancelMenuOption, "positions");
}
}

View file

@ -89,6 +89,11 @@ public final class FBReaderApp extends ZLApplication {
final ZLStringOption ColorProfileOption =
new ZLStringOption("Options", "ColorProfile", ColorProfile.DAY);
public final ZLBooleanOption ShowPreviousBookInCancelMenuOption =
new ZLBooleanOption("CancelMenu", "previousBook", false);
public final ZLBooleanOption ShowPositionsInCancelMenuOption =
new ZLBooleanOption("CancelMenu", "positions", true);
private final ZLKeyBindings myBindings = new ZLKeyBindings("Keys");
public final FBView BookTextView;
@ -324,17 +329,21 @@ public final class FBReaderApp extends ZLApplication {
public List<CancelActionDescription> getCancelActionsList() {
myCancelActionsList.clear();
if (ShowPreviousBookInCancelMenuOption.getValue()) {
final Book previousBook = Library.getPreviousBook();
if (previousBook != null) {
myCancelActionsList.add(new CancelActionDescription(
CancelActionType.previousBook, previousBook.getTitle()
));
}
}
if (ShowPositionsInCancelMenuOption.getValue()) {
if (Model != null && Model.Book != null) {
for (Bookmark bookmark : Bookmark.invisibleBookmarks(Model.Book)) {
myCancelActionsList.add(new BookmarkDescription(bookmark));
}
}
}
myCancelActionsList.add(new CancelActionDescription(
CancelActionType.close, null
));

View file

@ -408,6 +408,9 @@ public class NetworkLibrary {
}
public NetworkTree getTreeByKey(NetworkTree.Key key) {
if (key == null) {
return null;
}
if (key.Parent == null) {
return key.equals(myRootTree.getUniqueKey()) ? myRootTree : null;
}

View file

@ -174,7 +174,7 @@ public class LitResBookshelfItem extends NetworkCatalogItem {
listener.onNewItem(Link, item);
}
} else {
listener.onNewItem(Link, new ByDateCatalogItem(this, children));
//listener.onNewItem(Link, new ByDateCatalogItem(this, children));
listener.onNewItem(Link, new ByAuthorCatalogItem(this, children));
listener.onNewItem(Link, new ByTitleCatalogItem(this, children));
final BySeriesCatalogItem bySeries = new BySeriesCatalogItem(this, children);