mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-04 18:29:23 +02:00
book sharing, library & network libary itmes in cancel menu
This commit is contained in:
parent
93885f4c3b
commit
18f7e34f6a
15 changed files with 148 additions and 34 deletions
|
@ -1,4 +1,6 @@
|
||||||
===== 1.4.5 (Apr ??, 2012) =====
|
===== 1.4.5 (Apr ??, 2012) =====
|
||||||
|
* book sharing via e-mail, skype, etc
|
||||||
|
* 'Open library' and 'Open network library' items in back button menu
|
||||||
* ePub reader does not fail if NCX file in referenced but missing
|
* ePub reader does not fail if NCX file in referenced but missing
|
||||||
* native plugin does not crash if cache file cannot be created
|
* native plugin does not crash if cache file cannot be created
|
||||||
|
|
||||||
|
|
|
@ -212,6 +212,8 @@
|
||||||
</node>
|
</node>
|
||||||
</node>
|
</node>
|
||||||
<node name="cancelMenu">
|
<node name="cancelMenu">
|
||||||
|
<node name="library" value="Open library"/>
|
||||||
|
<node name="networkLibrary" value="Open network library"/>
|
||||||
<node name="previousBook" value="Open previous book"/>
|
<node name="previousBook" value="Open previous book"/>
|
||||||
<node name="returnTo" value="Return to …"/>
|
<node name="returnTo" value="Return to …"/>
|
||||||
<node name="back" value="Back"/>
|
<node name="back" value="Back"/>
|
||||||
|
@ -245,6 +247,7 @@
|
||||||
<node name="undo" value="Go Back"/>
|
<node name="undo" value="Go Back"/>
|
||||||
<node name="redo" value="Go Forward"/>
|
<node name="redo" value="Go Forward"/>
|
||||||
</node>
|
</node>
|
||||||
|
<node name="shareBook" value="Share book"/>
|
||||||
<node name="search" value="Search"/>
|
<node name="search" value="Search"/>
|
||||||
<node name="rotate" value="Rotate screen"/>
|
<node name="rotate" value="Rotate screen"/>
|
||||||
<node name="screenOrientation" value="Screen orientation"/>
|
<node name="screenOrientation" value="Screen orientation"/>
|
||||||
|
@ -651,6 +654,14 @@
|
||||||
</node>
|
</node>
|
||||||
<node name="cancelMenu" value="Cancel menu">
|
<node name="cancelMenu" value="Cancel menu">
|
||||||
<node name="summary" value="Back button action list"/>
|
<node name="summary" value="Back button action list"/>
|
||||||
|
<node name="library" value="Library">
|
||||||
|
<node name="summaryOn" value="Show 'open library' item"/>
|
||||||
|
<node name="summaryOff" value="Don't show 'open library' item"/>
|
||||||
|
</node>
|
||||||
|
<node name="networkLibrary" value="Network library">
|
||||||
|
<node name="summaryOn" value="Show 'open network library' item"/>
|
||||||
|
<node name="summaryOff" value="Don't show 'open network library' item"/>
|
||||||
|
</node>
|
||||||
<node name="previousBook" value="Previous book">
|
<node name="previousBook" value="Previous book">
|
||||||
<node name="summaryOn" value="Show 'return to previous book' item"/>
|
<node name="summaryOn" value="Show 'return to previous book' item"/>
|
||||||
<node name="summaryOff" value="Don't show 'return to previous book' item"/>
|
<node name="summaryOff" value="Don't show 'return to previous book' item"/>
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
</node>
|
</node>
|
||||||
<node name="openBook" value="Читать книгу"/>
|
<node name="openBook" value="Читать книгу"/>
|
||||||
<node name="showBookInfo" value="Информация о книге"/>
|
<node name="showBookInfo" value="Информация о книге"/>
|
||||||
|
<node name="shareBook" value="Поделиться книгой"/>
|
||||||
<node name="deleteBook" value="Удалить книгу"/>
|
<node name="deleteBook" value="Удалить книгу"/>
|
||||||
<node name="addToFavorites" value="Добавить в избранное"/>
|
<node name="addToFavorites" value="Добавить в избранное"/>
|
||||||
<node name="removeFromFavorites" value="Убрать из избранного"/>
|
<node name="removeFromFavorites" value="Убрать из избранного"/>
|
||||||
|
@ -222,6 +223,8 @@
|
||||||
</node>
|
</node>
|
||||||
</node>
|
</node>
|
||||||
<node name="cancelMenu">
|
<node name="cancelMenu">
|
||||||
|
<node name="library" value="Открыть библиотеку"/>
|
||||||
|
<node name="networkLibrary" value="Открыть сетевую библиотеку"/>
|
||||||
<node name="previousBook" value="Открыть предыдущую книгу"/>
|
<node name="previousBook" value="Открыть предыдущую книгу"/>
|
||||||
<node name="returnTo" value="Вернуться к ..."/>
|
<node name="returnTo" value="Вернуться к ..."/>
|
||||||
<node name="back" value="Назад"/>
|
<node name="back" value="Назад"/>
|
||||||
|
@ -255,6 +258,7 @@
|
||||||
<node name="undo" value="Назад"/>
|
<node name="undo" value="Назад"/>
|
||||||
<node name="redo" value="Вперед"/>
|
<node name="redo" value="Вперед"/>
|
||||||
</node>
|
</node>
|
||||||
|
<node name="shareBook" value="Поделиться книгой"/>
|
||||||
<node name="search" value="Поиск"/>
|
<node name="search" value="Поиск"/>
|
||||||
<node name="rotate" value="Повернуть"/>
|
<node name="rotate" value="Повернуть"/>
|
||||||
<node name="screenOrientation" value="Ориентация экрана"/>
|
<node name="screenOrientation" value="Ориентация экрана"/>
|
||||||
|
|
|
@ -62,7 +62,7 @@ abstract class ButtonsPopupPanel extends PopupPanel implements View.OnClickListe
|
||||||
|
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
final ActionButton button = (ActionButton)view;
|
final ActionButton button = (ActionButton)view;
|
||||||
Application.doAction(button.ActionId);
|
Application.runAction(button.ActionId);
|
||||||
if (button.IsCloseButton) {
|
if (button.IsCloseButton) {
|
||||||
storePosition();
|
storePosition();
|
||||||
StartPosition = null;
|
StartPosition = null;
|
||||||
|
|
|
@ -150,6 +150,7 @@ public final class FBReader extends ZLAndroidActivity {
|
||||||
fbReader.addAction(ActionCode.SHOW_MENU, new ShowMenuAction(this, fbReader));
|
fbReader.addAction(ActionCode.SHOW_MENU, new ShowMenuAction(this, fbReader));
|
||||||
fbReader.addAction(ActionCode.SHOW_NAVIGATION, new ShowNavigationAction(this, fbReader));
|
fbReader.addAction(ActionCode.SHOW_NAVIGATION, new ShowNavigationAction(this, fbReader));
|
||||||
fbReader.addAction(ActionCode.SEARCH, new SearchAction(this, fbReader));
|
fbReader.addAction(ActionCode.SEARCH, new SearchAction(this, fbReader));
|
||||||
|
fbReader.addAction(ActionCode.SHARE_BOOK, new ShareBookAction(this, fbReader));
|
||||||
|
|
||||||
fbReader.addAction(ActionCode.SELECTION_SHOW_PANEL, new SelectionShowPanelAction(this, fbReader));
|
fbReader.addAction(ActionCode.SELECTION_SHOW_PANEL, new SelectionShowPanelAction(this, fbReader));
|
||||||
fbReader.addAction(ActionCode.SELECTION_HIDE_PANEL, new SelectionHidePanelAction(this, fbReader));
|
fbReader.addAction(ActionCode.SELECTION_HIDE_PANEL, new SelectionHidePanelAction(this, fbReader));
|
||||||
|
@ -207,7 +208,7 @@ public final class FBReader extends ZLAndroidActivity {
|
||||||
super.onNewIntent(intent);
|
super.onNewIntent(intent);
|
||||||
} else if (Intent.ACTION_VIEW.equals(intent.getAction())
|
} else if (Intent.ACTION_VIEW.equals(intent.getAction())
|
||||||
&& data != null && "fbreader-action".equals(data.getScheme())) {
|
&& data != null && "fbreader-action".equals(data.getScheme())) {
|
||||||
fbReader.doAction(data.getEncodedSchemeSpecificPart(), data.getFragment());
|
fbReader.runAction(data.getEncodedSchemeSpecificPart(), data.getFragment());
|
||||||
} else if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
|
} else if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
|
||||||
final String pattern = intent.getStringExtra(SearchManager.QUERY);
|
final String pattern = intent.getStringExtra(SearchManager.QUERY);
|
||||||
final Runnable runnable = new Runnable() {
|
final Runnable runnable = new Runnable() {
|
||||||
|
@ -441,6 +442,7 @@ public final class FBReader extends ZLAndroidActivity {
|
||||||
addMenuItem(menu, ActionCode.SWITCH_TO_NIGHT_PROFILE, R.drawable.ic_menu_night);
|
addMenuItem(menu, ActionCode.SWITCH_TO_NIGHT_PROFILE, R.drawable.ic_menu_night);
|
||||||
addMenuItem(menu, ActionCode.SWITCH_TO_DAY_PROFILE, R.drawable.ic_menu_day);
|
addMenuItem(menu, ActionCode.SWITCH_TO_DAY_PROFILE, R.drawable.ic_menu_day);
|
||||||
addMenuItem(menu, ActionCode.SEARCH, R.drawable.ic_menu_search);
|
addMenuItem(menu, ActionCode.SEARCH, R.drawable.ic_menu_search);
|
||||||
|
addMenuItem(menu, ActionCode.SHARE_BOOK, R.drawable.ic_menu_search);
|
||||||
addMenuItem(menu, ActionCode.SHOW_PREFERENCES);
|
addMenuItem(menu, ActionCode.SHOW_PREFERENCES);
|
||||||
addMenuItem(menu, ActionCode.SHOW_BOOK_INFO);
|
addMenuItem(menu, ActionCode.SHOW_BOOK_INFO);
|
||||||
final Menu subMenu = addSubMenu(menu, "screenOrientation");
|
final Menu subMenu = addSubMenu(menu, "screenOrientation");
|
||||||
|
|
38
src/org/geometerplus/android/fbreader/ShareBookAction.java
Normal file
38
src/org/geometerplus/android/fbreader/ShareBookAction.java
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 Geometer Plus <contact@geometerplus.com>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||||
|
* 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.geometerplus.android.fbreader;
|
||||||
|
|
||||||
|
import org.geometerplus.fbreader.fbreader.FBReaderApp;
|
||||||
|
|
||||||
|
public class ShareBookAction extends FBAndroidAction {
|
||||||
|
ShareBookAction(FBReader baseActivity, FBReaderApp fbreader) {
|
||||||
|
super(baseActivity, fbreader);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isVisible() {
|
||||||
|
return Reader.Model != null && Reader.Model.Book.File.getPhysicalFile() != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void run(Object ... params) {
|
||||||
|
Util.shareBook(BaseActivity, Reader.Model.Book);
|
||||||
|
}
|
||||||
|
}
|
49
src/org/geometerplus/android/fbreader/Util.java
Normal file
49
src/org/geometerplus/android/fbreader/Util.java
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2010-2012 Geometer Plus <contact@geometerplus.com>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||||
|
* 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.geometerplus.android.fbreader;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.ActivityNotFoundException;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.net.Uri;
|
||||||
|
|
||||||
|
import org.geometerplus.zlibrary.core.filesystem.ZLPhysicalFile;
|
||||||
|
|
||||||
|
import org.geometerplus.fbreader.library.Book;
|
||||||
|
import org.geometerplus.fbreader.filetype.FileTypeCollection;
|
||||||
|
|
||||||
|
public abstract class Util {
|
||||||
|
public static void shareBook(Activity activity, Book book) {
|
||||||
|
try {
|
||||||
|
final ZLPhysicalFile file = book.File.getPhysicalFile();
|
||||||
|
if (file == null) {
|
||||||
|
// That should be impossible
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
activity.startActivity(
|
||||||
|
new Intent(Intent.ACTION_SEND)
|
||||||
|
.setType(FileTypeCollection.Instance.mimeType(book.File).Name)
|
||||||
|
.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file.javaFile()))
|
||||||
|
);
|
||||||
|
} catch (ActivityNotFoundException e) {
|
||||||
|
// TODO: show toast
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -21,7 +21,6 @@ package org.geometerplus.android.fbreader.library;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.content.*;
|
import android.content.*;
|
||||||
import android.net.Uri;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.*;
|
import android.view.*;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
|
@ -37,10 +36,10 @@ import org.geometerplus.zlibrary.ui.android.R;
|
||||||
|
|
||||||
import org.geometerplus.fbreader.library.*;
|
import org.geometerplus.fbreader.library.*;
|
||||||
import org.geometerplus.fbreader.tree.FBTree;
|
import org.geometerplus.fbreader.tree.FBTree;
|
||||||
import org.geometerplus.fbreader.filetype.FileTypeCollection;
|
|
||||||
|
|
||||||
import org.geometerplus.android.util.UIUtil;
|
import org.geometerplus.android.util.UIUtil;
|
||||||
import org.geometerplus.android.fbreader.FBReader;
|
import org.geometerplus.android.fbreader.FBReader;
|
||||||
|
import org.geometerplus.android.fbreader.Util;
|
||||||
import org.geometerplus.android.fbreader.tree.TreeActivity;
|
import org.geometerplus.android.fbreader.tree.TreeActivity;
|
||||||
|
|
||||||
public class LibraryActivity extends TreeActivity implements MenuItem.OnMenuItemClickListener, View.OnCreateContextMenuListener, Library.ChangeListener {
|
public class LibraryActivity extends TreeActivity implements MenuItem.OnMenuItemClickListener, View.OnCreateContextMenuListener, Library.ChangeListener {
|
||||||
|
@ -132,23 +131,6 @@ public class LibraryActivity extends TreeActivity implements MenuItem.OnMenuItem
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void shareBook(Book book) {
|
|
||||||
try {
|
|
||||||
final ZLPhysicalFile file = book.File.getPhysicalFile();
|
|
||||||
if (file == null) {
|
|
||||||
// That should be impossible
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
startActivity(
|
|
||||||
new Intent(Intent.ACTION_SEND)
|
|
||||||
.setType(FileTypeCollection.Instance.mimeType(book.File).Name)
|
|
||||||
.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file.javaFile()))
|
|
||||||
);
|
|
||||||
} catch (ActivityNotFoundException e) {
|
|
||||||
// TODO: show toast
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onActivityResult(int requestCode, int returnCode, Intent intent) {
|
protected void onActivityResult(int requestCode, int returnCode, Intent intent) {
|
||||||
if (requestCode == BOOK_INFO_REQUEST && intent != null) {
|
if (requestCode == BOOK_INFO_REQUEST && intent != null) {
|
||||||
|
@ -236,7 +218,7 @@ public class LibraryActivity extends TreeActivity implements MenuItem.OnMenuItem
|
||||||
showBookInfo(book);
|
showBookInfo(book);
|
||||||
return true;
|
return true;
|
||||||
case SHARE_BOOK_ITEM_ID:
|
case SHARE_BOOK_ITEM_ID:
|
||||||
shareBook(book);
|
Util.shareBook(this, book);
|
||||||
return true;
|
return true;
|
||||||
case ADD_TO_FAVORITES_ITEM_ID:
|
case ADD_TO_FAVORITES_ITEM_ID:
|
||||||
myLibrary.addBookToFavorites(book);
|
myLibrary.addBookToFavorites(book);
|
||||||
|
|
|
@ -433,6 +433,8 @@ public class PreferenceActivity extends ZLPreferenceActivity {
|
||||||
imagesScreen.addOption(fbReader.ImageViewBackgroundOption, "backgroundColor");
|
imagesScreen.addOption(fbReader.ImageViewBackgroundOption, "backgroundColor");
|
||||||
|
|
||||||
final Screen cancelMenuScreen = createPreferenceScreen("cancelMenu");
|
final Screen cancelMenuScreen = createPreferenceScreen("cancelMenu");
|
||||||
|
cancelMenuScreen.addOption(fbReader.ShowLibraryInCancelMenuOption, "library");
|
||||||
|
cancelMenuScreen.addOption(fbReader.ShowNetworkLibraryInCancelMenuOption, "networkLibrary");
|
||||||
cancelMenuScreen.addOption(fbReader.ShowPreviousBookInCancelMenuOption, "previousBook");
|
cancelMenuScreen.addOption(fbReader.ShowPreviousBookInCancelMenuOption, "previousBook");
|
||||||
cancelMenuScreen.addOption(fbReader.ShowPositionsInCancelMenuOption, "positions");
|
cancelMenuScreen.addOption(fbReader.ShowPositionsInCancelMenuOption, "positions");
|
||||||
final String[] backKeyActions =
|
final String[] backKeyActions =
|
||||||
|
|
|
@ -30,6 +30,8 @@ public interface ActionCode {
|
||||||
String SWITCH_TO_NIGHT_PROFILE = "night";
|
String SWITCH_TO_NIGHT_PROFILE = "night";
|
||||||
String SWITCH_TO_DAY_PROFILE = "day";
|
String SWITCH_TO_DAY_PROFILE = "day";
|
||||||
|
|
||||||
|
String SHARE_BOOK = "shareBook";
|
||||||
|
|
||||||
String SEARCH = "search";
|
String SEARCH = "search";
|
||||||
String FIND_PREVIOUS = "findPrevious";
|
String FIND_PREVIOUS = "findPrevious";
|
||||||
String FIND_NEXT = "findNext";
|
String FIND_NEXT = "findNext";
|
||||||
|
|
|
@ -97,6 +97,10 @@ public final class FBReaderApp extends ZLApplication {
|
||||||
final ZLStringOption ColorProfileOption =
|
final ZLStringOption ColorProfileOption =
|
||||||
new ZLStringOption("Options", "ColorProfile", ColorProfile.DAY);
|
new ZLStringOption("Options", "ColorProfile", ColorProfile.DAY);
|
||||||
|
|
||||||
|
public final ZLBooleanOption ShowLibraryInCancelMenuOption =
|
||||||
|
new ZLBooleanOption("CancelMenu", "library", true);
|
||||||
|
public final ZLBooleanOption ShowNetworkLibraryInCancelMenuOption =
|
||||||
|
new ZLBooleanOption("CancelMenu", "networkLibrary", false);
|
||||||
public final ZLBooleanOption ShowPreviousBookInCancelMenuOption =
|
public final ZLBooleanOption ShowPreviousBookInCancelMenuOption =
|
||||||
new ZLBooleanOption("CancelMenu", "previousBook", false);
|
new ZLBooleanOption("CancelMenu", "previousBook", false);
|
||||||
public final ZLBooleanOption ShowPositionsInCancelMenuOption =
|
public final ZLBooleanOption ShowPositionsInCancelMenuOption =
|
||||||
|
@ -362,6 +366,8 @@ public final class FBReaderApp extends ZLApplication {
|
||||||
}
|
}
|
||||||
|
|
||||||
static enum CancelActionType {
|
static enum CancelActionType {
|
||||||
|
library,
|
||||||
|
networkLibrary,
|
||||||
previousBook,
|
previousBook,
|
||||||
returnTo,
|
returnTo,
|
||||||
close
|
close
|
||||||
|
@ -394,6 +400,16 @@ public final class FBReaderApp extends ZLApplication {
|
||||||
|
|
||||||
public List<CancelActionDescription> getCancelActionsList() {
|
public List<CancelActionDescription> getCancelActionsList() {
|
||||||
myCancelActionsList.clear();
|
myCancelActionsList.clear();
|
||||||
|
if (ShowLibraryInCancelMenuOption.getValue()) {
|
||||||
|
myCancelActionsList.add(new CancelActionDescription(
|
||||||
|
CancelActionType.library, null
|
||||||
|
));
|
||||||
|
}
|
||||||
|
if (ShowNetworkLibraryInCancelMenuOption.getValue()) {
|
||||||
|
myCancelActionsList.add(new CancelActionDescription(
|
||||||
|
CancelActionType.networkLibrary, null
|
||||||
|
));
|
||||||
|
}
|
||||||
if (ShowPreviousBookInCancelMenuOption.getValue()) {
|
if (ShowPreviousBookInCancelMenuOption.getValue()) {
|
||||||
final Book previousBook = Library.Instance().getPreviousBook();
|
final Book previousBook = Library.Instance().getPreviousBook();
|
||||||
if (previousBook != null) {
|
if (previousBook != null) {
|
||||||
|
@ -422,6 +438,12 @@ public final class FBReaderApp extends ZLApplication {
|
||||||
|
|
||||||
final CancelActionDescription description = myCancelActionsList.get(index);
|
final CancelActionDescription description = myCancelActionsList.get(index);
|
||||||
switch (description.Type) {
|
switch (description.Type) {
|
||||||
|
case library:
|
||||||
|
runAction(ActionCode.SHOW_LIBRARY);
|
||||||
|
break;
|
||||||
|
case networkLibrary:
|
||||||
|
runAction(ActionCode.SHOW_NETWORK_LIBRARY);
|
||||||
|
break;
|
||||||
case previousBook:
|
case previousBook:
|
||||||
openBook(Library.Instance().getPreviousBook(), null, null);
|
openBook(Library.Instance().getPreviousBook(), null, null);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -79,11 +79,11 @@ public final class FBView extends ZLTextView {
|
||||||
selectRegion(region);
|
selectRegion(region);
|
||||||
myReader.getViewWidget().reset();
|
myReader.getViewWidget().reset();
|
||||||
myReader.getViewWidget().repaint();
|
myReader.getViewWidget().repaint();
|
||||||
myReader.doAction(ActionCode.PROCESS_HYPERLINK);
|
myReader.runAction(ActionCode.PROCESS_HYPERLINK);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
myReader.doAction(getZoneMap().getActionByCoordinates(
|
myReader.runAction(getZoneMap().getActionByCoordinates(
|
||||||
x, y, myContext.getWidth(), myContext.getHeight(),
|
x, y, myContext.getWidth(), myContext.getHeight(),
|
||||||
isDoubleTapSupported() ? TapZoneMap.Tap.singleNotDoubleTap : TapZoneMap.Tap.singleTap
|
isDoubleTapSupported() ? TapZoneMap.Tap.singleNotDoubleTap : TapZoneMap.Tap.singleTap
|
||||||
), x, y);
|
), x, y);
|
||||||
|
@ -101,7 +101,7 @@ public final class FBView extends ZLTextView {
|
||||||
if (super.onFingerDoubleTap(x, y)) {
|
if (super.onFingerDoubleTap(x, y)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
myReader.doAction(getZoneMap().getActionByCoordinates(
|
myReader.runAction(getZoneMap().getActionByCoordinates(
|
||||||
x, y, myContext.getWidth(), myContext.getHeight(), TapZoneMap.Tap.doubleTap
|
x, y, myContext.getWidth(), myContext.getHeight(), TapZoneMap.Tap.doubleTap
|
||||||
), x, y);
|
), x, y);
|
||||||
return true;
|
return true;
|
||||||
|
@ -114,7 +114,7 @@ public final class FBView extends ZLTextView {
|
||||||
|
|
||||||
final ZLTextSelectionCursor cursor = findSelectionCursor(x, y, MAX_SELECTION_DISTANCE);
|
final ZLTextSelectionCursor cursor = findSelectionCursor(x, y, MAX_SELECTION_DISTANCE);
|
||||||
if (cursor != ZLTextSelectionCursor.None) {
|
if (cursor != ZLTextSelectionCursor.None) {
|
||||||
myReader.doAction(ActionCode.SELECTION_HIDE_PANEL);
|
myReader.runAction(ActionCode.SELECTION_HIDE_PANEL);
|
||||||
moveSelectionCursorTo(cursor, x, y);
|
moveSelectionCursorTo(cursor, x, y);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -216,7 +216,7 @@ public final class FBView extends ZLTextView {
|
||||||
if (soul instanceof ZLTextWordRegionSoul) {
|
if (soul instanceof ZLTextWordRegionSoul) {
|
||||||
switch (myReader.WordTappingActionOption.getValue()) {
|
switch (myReader.WordTappingActionOption.getValue()) {
|
||||||
case startSelecting:
|
case startSelecting:
|
||||||
myReader.doAction(ActionCode.SELECTION_HIDE_PANEL);
|
myReader.runAction(ActionCode.SELECTION_HIDE_PANEL);
|
||||||
initSelection(x, y);
|
initSelection(x, y);
|
||||||
final ZLTextSelectionCursor cursor = findSelectionCursor(x, y);
|
final ZLTextSelectionCursor cursor = findSelectionCursor(x, y);
|
||||||
if (cursor != ZLTextSelectionCursor.None) {
|
if (cursor != ZLTextSelectionCursor.None) {
|
||||||
|
@ -308,7 +308,7 @@ public final class FBView extends ZLTextView {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (doRunAction) {
|
if (doRunAction) {
|
||||||
myReader.doAction(ActionCode.PROCESS_HYPERLINK);
|
myReader.runAction(ActionCode.PROCESS_HYPERLINK);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -584,7 +584,7 @@ public final class FBView extends ZLTextView {
|
||||||
protected void releaseSelectionCursor() {
|
protected void releaseSelectionCursor() {
|
||||||
super.releaseSelectionCursor();
|
super.releaseSelectionCursor();
|
||||||
if (getCountOfSelectedWords() > 0) {
|
if (getCountOfSelectedWords() > 0) {
|
||||||
myReader.doAction(ActionCode.SELECTION_SHOW_PANEL);
|
myReader.runAction(ActionCode.SELECTION_SHOW_PANEL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -141,7 +141,7 @@ public abstract class ZLApplication {
|
||||||
return action != null ? action.isChecked() : ZLBoolean3.B3_UNDEFINED;
|
return action != null ? action.isChecked() : ZLBoolean3.B3_UNDEFINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void doAction(String actionId, Object ... params) {
|
public final void runAction(String actionId, Object ... params) {
|
||||||
final ZLAction action = myIdToActionMap.get(actionId);
|
final ZLAction action = myIdToActionMap.get(actionId);
|
||||||
if (action != null) {
|
if (action != null) {
|
||||||
action.checkAndRun(params);
|
action.checkAndRun(params);
|
||||||
|
@ -156,7 +156,7 @@ public abstract class ZLApplication {
|
||||||
return actionId != null && !NoAction.equals(actionId);
|
return actionId != null && !NoAction.equals(actionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final boolean doActionByKey(int key, boolean longPress) {
|
public final boolean runActionByKey(int key, boolean longPress) {
|
||||||
final String actionId = keyBindings().getBinding(key, longPress);
|
final String actionId = keyBindings().getBinding(key, longPress);
|
||||||
if (actionId != null) {
|
if (actionId != null) {
|
||||||
final ZLAction action = myIdToActionMap.get(actionId);
|
final ZLAction action = myIdToActionMap.get(actionId);
|
||||||
|
|
|
@ -46,7 +46,7 @@ public final class ZLAndroidApplicationWindow extends ZLApplicationWindow {
|
||||||
private final MenuItem.OnMenuItemClickListener myMenuListener =
|
private final MenuItem.OnMenuItemClickListener myMenuListener =
|
||||||
new MenuItem.OnMenuItemClickListener() {
|
new MenuItem.OnMenuItemClickListener() {
|
||||||
public boolean onMenuItemClick(MenuItem item) {
|
public boolean onMenuItemClick(MenuItem item) {
|
||||||
getApplication().doAction(myMenuItemMap.get(item));
|
getApplication().runAction(myMenuItemMap.get(item));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -406,7 +406,7 @@ public class ZLAndroidWidget extends View implements ZLViewWidget, View.OnLongCl
|
||||||
myTrackingStartTime = System.currentTimeMillis();
|
myTrackingStartTime = System.currentTimeMillis();
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return application.doActionByKey(keyCode, false);
|
return application.runActionByKey(keyCode, false);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
@ -418,7 +418,7 @@ public class ZLAndroidWidget extends View implements ZLViewWidget, View.OnLongCl
|
||||||
if (myKeyUnderTracking == keyCode) {
|
if (myKeyUnderTracking == keyCode) {
|
||||||
final boolean longPress = System.currentTimeMillis() >
|
final boolean longPress = System.currentTimeMillis() >
|
||||||
myTrackingStartTime + ViewConfiguration.getLongPressTimeout();
|
myTrackingStartTime + ViewConfiguration.getLongPressTimeout();
|
||||||
ZLApplication.Instance().doActionByKey(keyCode, longPress);
|
ZLApplication.Instance().runActionByKey(keyCode, longPress);
|
||||||
}
|
}
|
||||||
myKeyUnderTracking = -1;
|
myKeyUnderTracking = -1;
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue