📄 readersetting.java
字号:
package com.ismyway.anyview.win;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.TextField;
import com.ismyway.anyview.others.Configure;
import com.ismyway.anyview.others.Reader;
import com.ismyway.fairyui.Component;
import com.ismyway.fairyui.Handset;
import com.ismyway.fairyui.InputBlock;
import com.ismyway.fairyui.ListBox;
import com.ismyway.fairyui.ListElement;
import com.ismyway.fairyui.NewLine;
import com.ismyway.fairyui.Panel;
import com.ismyway.fairyui.Row;
import com.ismyway.fairyui.Slider;
import com.ismyway.fairyui.TextBlock;
import com.ismyway.util.Res;
public class ReaderSetting extends Panel {
ListBox options = new ListBox(false);
ListElement noBr;
ListElement smartLine;
ListElement showPercent;
ListElement flashBackLight;
ListElement showHistory;
InputBlock autoShutdown;
Slider readerbuffer = new Slider();
ListBox indicator = new ListBox(true);
InputBlock[] pagePadding = new InputBlock[2];
InputBlock lightValue = new InputBlock();
public ReaderSetting() {
setTitle(Res.get("Reader") + Res.get("Setup"));
Row row = new Row();
row.add(new TextBlock(Res.get("Reader") + Res.get("Buffer")
+ "(for test)"));
// row.add(new NewLine(1, new Integer(Theme.ComponentLight),
// Graphics.DOTTED));
add(row);
readerbuffer.setParameters(1024, 16384, Reader.bufferLength);
readerbuffer.setStep(1024);
readerbuffer.setFaststep(4096);
add(readerbuffer);
//阅读选项
noBr = new ListElement(Res.get("Delete BR"), Configure.noBr);
options.add(noBr);
smartLine = new ListElement(Res.get("Smart BreakLine"),
Configure.smartLine);
// options.add(smartLine);
showPercent = new ListElement(Res.get("Show Percent"),
Configure.showPercent);
options.add(showPercent);
flashBackLight = new ListElement(Res.get("Flash BackLight"),
Configure.flashBackLight);
options.add(flashBackLight);
showHistory = new ListElement(Res.get("Show History"), Configure.showHistory);
options.add(showHistory);
add(options);
Row row2 = new Row();
if (Handset.suppertDeviceControl()) {
row2.add(new TextBlock(Res.get("Level:") + "(0~100)", true));
lightValue.setConstrains(TextField.NUMERIC);
lightValue.setText("" + Configure.lightValue);
row2.add(lightValue);
row2.add(new NewLine());
}
row2.add(new TextBlock(Res.get("Auto Shutdown") + "(>=0)", true));
autoShutdown = new InputBlock(10, "" + (Configure.shutDownTime / 60000));
row2.add(autoShutdown);
row2.add(new NewLine());
row2.add(new TextBlock(Res.get("Reader") + Res.get("Indicator")));
add(row2);
indicator.add(new ListElement(Res.get("Disable"),
Configure.indicator == 0));
indicator.add(new ListElement(Res.get("Up"), Configure.indicator == 1));
indicator
.add(new ListElement(Res.get("Down"), Configure.indicator == 2));
indicator
.add(new ListElement(Res.get("Left"), Configure.indicator == 3));
indicator.add(new ListElement(Res.get("Right"),
Configure.indicator == 4));
add(indicator);
//页边距(上下左右)
Row rowPage = new Row();
rowPage.add(new TextBlock(Res.get("Page Padding"), true));
// rowPage.add(new NewLine(1, new Integer(Theme.ComponentLight),
// Graphics.DOTTED));
pagePadding[0] = new InputBlock();
pagePadding[0].setText("" + ((Configure.padding >> 8) & 0xff));
pagePadding[0].setConstrains(TextField.NUMERIC);
rowPage.add(new TextBlock(Res.get("Left")));
rowPage.add(pagePadding[0]);
pagePadding[1] = new InputBlock();
pagePadding[1].setText("" + ((Configure.padding) & 0xff));
pagePadding[1].setConstrains(TextField.NUMERIC);
rowPage.add(new TextBlock(Res.get("Right")));
rowPage.add(pagePadding[1]);
add(rowPage);
addCommand(new Command(Res.get("Save"), Command.OK, 1));
addCommand(new Command(Res.get("Close"), Command.EXIT, 1));
}
public void commandAction(Command cmd, Component c) {
String str = cmd.getLabel();
if (str.equals(Res.get("Save"))) {
Reader.bufferLength = readerbuffer.getCurrent();
Configure.noBr = noBr.isChecked();
Configure.smartLine = smartLine.isChecked();
Configure.showPercent = showPercent.isChecked();
try {
int shut = Integer.parseInt(autoShutdown.getText());
shut = shut & 0xFFFF;
Configure.shutDownTime = shut * 60000;
} catch (Exception e) {
Configure.shutDownTime = 0;
}
try {
Configure.indicator = (byte) indicator.getCheckedIndex();
} catch (Exception e) {
Configure.indicator = 4;
}
if (Handset.suppertDeviceControl()) {
try {
int lv = Integer.parseInt(lightValue.getText());
lv = lv > 100 ? 100 : lv;
lv = lv < 0 ? 0 : lv;
Configure.lightValue = (byte)lv;
} catch (Exception e) {
Configure.lightValue = 100;
}
}
try {
Configure.padding = (
((Integer.parseInt(pagePadding[0].getText()) & 0xff) << 8)
| ((Integer.parseInt(pagePadding[1].getText()) & 0xff)));
} catch (Exception e) {
Configure.padding = 0;
}
Configure.flashBackLight = flashBackLight.isChecked();
Configure.showHistory = showHistory.isChecked();
Configure.save();
mainCanvas.closePopup();
} else if (str.equals(Res.get("Close"))) {
mainCanvas.closePopup();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -