1
0
Fork 0
mirror of https://github.com/geometer/FBReaderJ.git synced 2025-10-05 19:42:17 +02:00

more options moved to ViewOptions class

This commit is contained in:
Nikolay Pultsin 2013-12-28 17:22:35 +02:00
parent 90c22c10d2
commit f075c5f9cc
4 changed files with 30 additions and 27 deletions

View file

@ -374,7 +374,7 @@ public class PreferenceActivity extends ZLPreferenceActivity {
final String[] scrollBarTypes = {"hide", "show", "showAsProgress", "showAsFooter"};
statusLineScreen.addPreference(new ZLChoicePreference(
this, statusLineScreen.Resource, "scrollbarType",
fbReader.ScrollbarTypeOption, scrollBarTypes
viewOptions.ScrollbarType, scrollBarTypes
) {
@Override
protected void onDialogClosed(boolean result) {
@ -401,7 +401,7 @@ public class PreferenceActivity extends ZLPreferenceActivity {
footerOptions.Font, false
)));
footerPreferences.setEnabled(
fbReader.ScrollbarTypeOption.getValue() == FBView.SCROLLBAR_SHOW_AS_FOOTER
viewOptions.ScrollbarType.getValue() == FBView.SCROLLBAR_SHOW_AS_FOOTER
);
/*

View file

@ -52,11 +52,6 @@ public final class FBReaderApp extends ZLApplication {
public final ImageOptions ImageOptions;
public final ViewOptions ViewOptions;
public final ZLIntegerRangeOption ScrollbarTypeOption;
final ZLStringOption ColorProfileOption;
public final PageTurningOptions PageTurningOptions;
public final FooterOptions FooterOptions;
@ -80,13 +75,6 @@ public final class FBReaderApp extends ZLApplication {
ImageOptions = new ImageOptions();
ViewOptions = new ViewOptions();
ScrollbarTypeOption =
new ZLIntegerRangeOption("Options", "ScrollbarType", 0, 3, FBView.SCROLLBAR_SHOW_AS_FOOTER);
ColorProfileOption =
new ZLStringOption("Options", "ColorProfile", ColorProfile.DAY);
PageTurningOptions = new PageTurningOptions();
FooterOptions = new FooterOptions();
@ -196,11 +184,11 @@ public final class FBReaderApp extends ZLApplication {
}
public String getColorProfileName() {
return ColorProfileOption.getValue();
return ViewOptions.ColorProfileName.getValue();
}
public void setColorProfileName(String name) {
ColorProfileOption.setValue(name);
ViewOptions.ColorProfileName.setValue(name);
myColorProfile = null;
}

View file

@ -603,7 +603,7 @@ public final class FBView extends ZLTextView {
@Override
public Footer getFooterArea() {
if (myReader.ScrollbarTypeOption.getValue() == SCROLLBAR_SHOW_AS_FOOTER) {
if (myReader.ViewOptions.ScrollbarType.getValue() == SCROLLBAR_SHOW_AS_FOOTER) {
if (myFooter == null) {
myFooter = new Footer();
myReader.addTimerTask(myFooter.UpdateTask, 15000);
@ -645,7 +645,7 @@ public final class FBView extends ZLTextView {
@Override
public int scrollbarType() {
return myReader.ScrollbarTypeOption.getValue();
return myReader.ViewOptions.ScrollbarType.getValue();
}
@Override

View file

@ -20,8 +20,10 @@
package org.geometerplus.fbreader.fbreader.options;
import org.geometerplus.zlibrary.core.library.ZLibrary;
import org.geometerplus.zlibrary.core.options.ZLBooleanOption;
import org.geometerplus.zlibrary.core.options.ZLIntegerRangeOption;
import org.geometerplus.zlibrary.core.options.*;
import org.geometerplus.fbreader.fbreader.FBView;
import org.geometerplus.fbreader.fbreader.ColorProfile;
public class ViewOptions {
public final ZLBooleanOption TwoColumnView;
@ -30,7 +32,9 @@ public class ViewOptions {
public final ZLIntegerRangeOption TopMargin;
public final ZLIntegerRangeOption BottomMargin;
public final ZLIntegerRangeOption SpaceBetweenColumns;
public final ZLIntegerRangeOption ScrollbarType;
public final ZLIntegerRangeOption FooterHeight;
public final ZLStringOption ColorProfileName;
public ViewOptions() {
final ZLibrary zlibrary = ZLibrary.Instance();
@ -40,12 +44,23 @@ public class ViewOptions {
final int y = zlibrary.getHeightInPixels();
final int horMargin = Math.min(dpi / 5, Math.min(x, y) / 30);
TwoColumnView = new ZLBooleanOption("Options", "TwoColumnView", x * x + y * y >= 42 * dpi * dpi);
LeftMargin = new ZLIntegerRangeOption("Options", "LeftMargin", 0, 100, horMargin);
RightMargin = new ZLIntegerRangeOption("Options", "RightMargin", 0, 100, horMargin);
TopMargin = new ZLIntegerRangeOption("Options", "TopMargin", 0, 100, 0);
BottomMargin = new ZLIntegerRangeOption("Options", "BottomMargin", 0, 100, 4);
SpaceBetweenColumns = new ZLIntegerRangeOption("Options", "SpaceBetweenColumns", 0, 300, 3 * horMargin);
FooterHeight = new ZLIntegerRangeOption("Options", "FooterHeight", 8, dpi / 8, dpi / 20);
TwoColumnView =
new ZLBooleanOption("Options", "TwoColumnView", x * x + y * y >= 42 * dpi * dpi);
LeftMargin =
new ZLIntegerRangeOption("Options", "LeftMargin", 0, 100, horMargin);
RightMargin =
new ZLIntegerRangeOption("Options", "RightMargin", 0, 100, horMargin);
TopMargin =
new ZLIntegerRangeOption("Options", "TopMargin", 0, 100, 0);
BottomMargin =
new ZLIntegerRangeOption("Options", "BottomMargin", 0, 100, 4);
SpaceBetweenColumns =
new ZLIntegerRangeOption("Options", "SpaceBetweenColumns", 0, 300, 3 * horMargin);
ScrollbarType =
new ZLIntegerRangeOption("Options", "ScrollbarType", 0, 3, FBView.SCROLLBAR_SHOW_AS_FOOTER);
FooterHeight =
new ZLIntegerRangeOption("Options", "FooterHeight", 8, dpi / 8, dpi / 20);
ColorProfileName =
new ZLStringOption("Options", "ColorProfile", ColorProfile.DAY);
}
}