mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-05 10:49:24 +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.view.ZLView;
|
||||
|
||||
import org.geometerplus.zlibrary.text.view.ZLTextFixedPosition;
|
||||
import org.geometerplus.zlibrary.text.view.ZLTextPosition;
|
||||
import org.geometerplus.zlibrary.text.view.ZLTextWordCursor;
|
||||
import org.geometerplus.zlibrary.text.view.ZLTextView;
|
||||
import org.geometerplus.zlibrary.text.hyphenation.ZLTextHyphenator;
|
||||
|
||||
|
@ -64,7 +63,7 @@ public final class FBReader extends ZLAndroidActivity {
|
|||
|
||||
private class NavigationButtonPanel extends ControlButtonPanel {
|
||||
public volatile boolean NavigateDragging;
|
||||
public ZLTextPosition StartPosition;
|
||||
public ZLTextWordCursor StartPosition;
|
||||
|
||||
@Override
|
||||
public void onShow() {
|
||||
|
@ -283,27 +282,25 @@ public final class FBReader extends ZLAndroidActivity {
|
|||
}
|
||||
final ZLTextView textView = (ZLTextView)ZLApplication.Instance().getCurrentView();
|
||||
myNavigatePanel.NavigateDragging = false;
|
||||
myNavigatePanel.StartPosition = new ZLTextFixedPosition(textView.getStartCursor());
|
||||
myNavigatePanel.StartPosition = new ZLTextWordCursor(textView.getStartCursor());
|
||||
myNavigatePanel.show(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
private final void createNavigation(View layout) {
|
||||
final FBReaderApp fbreader = (FBReaderApp)ZLApplication.Instance();
|
||||
final SeekBar slider = (SeekBar)layout.findViewById(R.id.book_position_slider);
|
||||
final TextView text = (TextView)layout.findViewById(R.id.book_position_text);
|
||||
|
||||
slider.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
||||
private void gotoPage(int page) {
|
||||
final ZLView view = ZLApplication.Instance().getCurrentView();
|
||||
if (view instanceof ZLTextView) {
|
||||
ZLTextView textView = (ZLTextView)view;
|
||||
if (page == 1) {
|
||||
textView.gotoHome();
|
||||
} else {
|
||||
textView.gotoPage(page);
|
||||
}
|
||||
ZLApplication.Instance().repaintView();
|
||||
final ZLTextView view = fbreader.getTextView();
|
||||
if (page == 1) {
|
||||
view.gotoHome();
|
||||
} else {
|
||||
view.gotoPage(page);
|
||||
}
|
||||
fbreader.repaintView();
|
||||
}
|
||||
|
||||
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);
|
||||
View.OnClickListener listener = new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
final ZLTextPosition position = myNavigatePanel.StartPosition;
|
||||
final ZLTextWordCursor position = myNavigatePanel.StartPosition;
|
||||
myNavigatePanel.StartPosition = 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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue