mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-04 18:29:23 +02:00
cancel menu (done)
This commit is contained in:
parent
43c22be00d
commit
49adf8f9dc
4 changed files with 40 additions and 24 deletions
|
@ -35,8 +35,7 @@ import org.geometerplus.zlibrary.core.filesystem.ZLFile;
|
||||||
import org.geometerplus.zlibrary.core.resources.ZLResource;
|
import org.geometerplus.zlibrary.core.resources.ZLResource;
|
||||||
import org.geometerplus.zlibrary.core.view.ZLView;
|
import org.geometerplus.zlibrary.core.view.ZLView;
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.text.view.ZLTextFixedPosition;
|
import org.geometerplus.zlibrary.text.view.ZLTextWordCursor;
|
||||||
import org.geometerplus.zlibrary.text.view.ZLTextPosition;
|
|
||||||
import org.geometerplus.zlibrary.text.view.ZLTextView;
|
import org.geometerplus.zlibrary.text.view.ZLTextView;
|
||||||
import org.geometerplus.zlibrary.text.hyphenation.ZLTextHyphenator;
|
import org.geometerplus.zlibrary.text.hyphenation.ZLTextHyphenator;
|
||||||
|
|
||||||
|
@ -64,7 +63,7 @@ public final class FBReader extends ZLAndroidActivity {
|
||||||
|
|
||||||
private class NavigationButtonPanel extends ControlButtonPanel {
|
private class NavigationButtonPanel extends ControlButtonPanel {
|
||||||
public volatile boolean NavigateDragging;
|
public volatile boolean NavigateDragging;
|
||||||
public ZLTextPosition StartPosition;
|
public ZLTextWordCursor StartPosition;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onShow() {
|
public void onShow() {
|
||||||
|
@ -283,27 +282,25 @@ public final class FBReader extends ZLAndroidActivity {
|
||||||
}
|
}
|
||||||
final ZLTextView textView = (ZLTextView)ZLApplication.Instance().getCurrentView();
|
final ZLTextView textView = (ZLTextView)ZLApplication.Instance().getCurrentView();
|
||||||
myNavigatePanel.NavigateDragging = false;
|
myNavigatePanel.NavigateDragging = false;
|
||||||
myNavigatePanel.StartPosition = new ZLTextFixedPosition(textView.getStartCursor());
|
myNavigatePanel.StartPosition = new ZLTextWordCursor(textView.getStartCursor());
|
||||||
myNavigatePanel.show(true);
|
myNavigatePanel.show(true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private final void createNavigation(View layout) {
|
private final void createNavigation(View layout) {
|
||||||
|
final FBReaderApp fbreader = (FBReaderApp)ZLApplication.Instance();
|
||||||
final SeekBar slider = (SeekBar)layout.findViewById(R.id.book_position_slider);
|
final SeekBar slider = (SeekBar)layout.findViewById(R.id.book_position_slider);
|
||||||
final TextView text = (TextView)layout.findViewById(R.id.book_position_text);
|
final TextView text = (TextView)layout.findViewById(R.id.book_position_text);
|
||||||
|
|
||||||
slider.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
slider.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
||||||
private void gotoPage(int page) {
|
private void gotoPage(int page) {
|
||||||
final ZLView view = ZLApplication.Instance().getCurrentView();
|
final ZLTextView view = fbreader.getTextView();
|
||||||
if (view instanceof ZLTextView) {
|
if (page == 1) {
|
||||||
ZLTextView textView = (ZLTextView)view;
|
view.gotoHome();
|
||||||
if (page == 1) {
|
} else {
|
||||||
textView.gotoHome();
|
view.gotoPage(page);
|
||||||
} else {
|
|
||||||
textView.gotoPage(page);
|
|
||||||
}
|
|
||||||
ZLApplication.Instance().repaintView();
|
|
||||||
}
|
}
|
||||||
|
fbreader.repaintView();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onStopTrackingTouch(SeekBar seekBar) {
|
public void onStopTrackingTouch(SeekBar seekBar) {
|
||||||
|
@ -328,10 +325,12 @@ public final class FBReader extends ZLAndroidActivity {
|
||||||
final Button btnCancel = (Button)layout.findViewById(android.R.id.button3);
|
final Button btnCancel = (Button)layout.findViewById(android.R.id.button3);
|
||||||
View.OnClickListener listener = new View.OnClickListener() {
|
View.OnClickListener listener = new View.OnClickListener() {
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
final ZLTextPosition position = myNavigatePanel.StartPosition;
|
final ZLTextWordCursor position = myNavigatePanel.StartPosition;
|
||||||
myNavigatePanel.StartPosition = null;
|
myNavigatePanel.StartPosition = null;
|
||||||
if (v == btnCancel && position != null) {
|
if (v == btnCancel && position != null) {
|
||||||
((ZLTextView)ZLApplication.Instance().getCurrentView()).gotoPosition(position);
|
fbreader.getTextView().gotoPosition(position);
|
||||||
|
} else if (v == btnOk) {
|
||||||
|
fbreader.addInvisibleBookmark(position);
|
||||||
}
|
}
|
||||||
myNavigatePanel.hide(true);
|
myNavigatePanel.hide(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,6 +121,7 @@ public class TOCActivity extends ListActivity {
|
||||||
if (reference != null) {
|
if (reference != null) {
|
||||||
finish();
|
finish();
|
||||||
final FBReaderApp fbreader = (FBReaderApp)ZLApplication.Instance();
|
final FBReaderApp fbreader = (FBReaderApp)ZLApplication.Instance();
|
||||||
|
fbreader.addInvisibleBookmark();
|
||||||
fbreader.BookTextView.gotoPosition(reference.ParagraphIndex, 0, 0);
|
fbreader.BookTextView.gotoPosition(reference.ParagraphIndex, 0, 0);
|
||||||
fbreader.showBookTextView();
|
fbreader.showBookTextView();
|
||||||
}
|
}
|
||||||
|
|
|
@ -364,19 +364,34 @@ public final class FBReaderApp extends ZLApplication {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addInvisibleBookmark() {
|
private void updateInvisibleBookmarksList(Bookmark b) {
|
||||||
if (Model.Book != null) {
|
if (Model.Book != null && b != null) {
|
||||||
final Bookmark b = addBookmark(6, false);
|
b.save();
|
||||||
if (b != null) {
|
final List<Bookmark> bookmarks = Bookmark.invisibleBookmarks(Model.Book);
|
||||||
b.save();
|
for (int i = 3; i < bookmarks.size(); ++i) {
|
||||||
final List<Bookmark> bookmarks = Bookmark.invisibleBookmarks(Model.Book);
|
bookmarks.get(i).delete();
|
||||||
for (int i = 3; i < bookmarks.size(); ++i) {
|
|
||||||
bookmarks.get(i).delete();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addInvisibleBookmark(ZLTextWordCursor cursor) {
|
||||||
|
if (Model.Book != null && getTextView() == BookTextView) {
|
||||||
|
updateInvisibleBookmarksList(new Bookmark(
|
||||||
|
Model.Book,
|
||||||
|
getTextView().getModel().getId(),
|
||||||
|
cursor,
|
||||||
|
6,
|
||||||
|
false
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addInvisibleBookmark() {
|
||||||
|
if (Model.Book != null && getTextView() == BookTextView) {
|
||||||
|
updateInvisibleBookmarksList(addBookmark(6, false));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Bookmark addBookmark(int maxLength, boolean visible) {
|
public Bookmark addBookmark(int maxLength, boolean visible) {
|
||||||
final FBView view = getTextView();
|
final FBView view = getTextView();
|
||||||
final ZLTextWordCursor cursor = view.getStartCursor();
|
final ZLTextWordCursor cursor = view.getStartCursor();
|
||||||
|
|
|
@ -175,6 +175,7 @@ public final class FBView extends ZLTextView {
|
||||||
if (myReader.FooterIsSensitiveOption.getValue()) {
|
if (myReader.FooterIsSensitiveOption.getValue()) {
|
||||||
Footer footer = getFooterArea();
|
Footer footer = getFooterArea();
|
||||||
if (footer != null && y > myContext.getHeight() - footer.getTapHeight()) {
|
if (footer != null && y > myContext.getHeight() - footer.getTapHeight()) {
|
||||||
|
myReader.addInvisibleBookmark();
|
||||||
footer.setProgress(x);
|
footer.setProgress(x);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue