1
0
Fork 0
mirror of https://github.com/geometer/FBReaderJ.git synced 2025-10-04 18:29:23 +02:00

formatting cleanup

This commit is contained in:
Nikolay Pultsin 2013-02-01 15:55:02 +00:00
parent fcafd8120a
commit dc59bf47e4
102 changed files with 498 additions and 498 deletions

View file

@ -4,47 +4,47 @@ import java.util.*;
import java.io.*;
public abstract class Decompressor {
public Decompressor(MyBufferedInputStream is, LocalFileHeader header) {
}
public Decompressor(MyBufferedInputStream is, LocalFileHeader header) {
}
/**
* byte b[] -- target buffer for bytes; might be null
*/
public abstract int read(byte b[], int off, int len) throws IOException;
public abstract int read() throws IOException;
public abstract int read(byte b[], int off, int len) throws IOException;
public abstract int read() throws IOException;
protected Decompressor() {
}
protected Decompressor() {
}
private static Queue<DeflatingDecompressor> ourDeflators = new LinkedList<DeflatingDecompressor>();
private static Queue<DeflatingDecompressor> ourDeflators = new LinkedList<DeflatingDecompressor>();
static void storeDecompressor(Decompressor decompressor) {
if (decompressor instanceof DeflatingDecompressor) {
synchronized (ourDeflators) {
ourDeflators.add((DeflatingDecompressor)decompressor);
}
}
}
static void storeDecompressor(Decompressor decompressor) {
if (decompressor instanceof DeflatingDecompressor) {
synchronized (ourDeflators) {
ourDeflators.add((DeflatingDecompressor)decompressor);
}
}
}
static Decompressor init(MyBufferedInputStream is, LocalFileHeader header) throws IOException {
switch (header.CompressionMethod) {
case 0:
return new NoCompressionDecompressor(is, header);
case 8:
synchronized (ourDeflators) {
if (!ourDeflators.isEmpty()) {
DeflatingDecompressor decompressor = ourDeflators.poll();
decompressor.reset(is, header);
return decompressor;
}
}
return new DeflatingDecompressor(is, header);
default:
throw new ZipException("Unsupported method of compression");
}
}
public int available() throws IOException {
return -1;
}
static Decompressor init(MyBufferedInputStream is, LocalFileHeader header) throws IOException {
switch (header.CompressionMethod) {
case 0:
return new NoCompressionDecompressor(is, header);
case 8:
synchronized (ourDeflators) {
if (!ourDeflators.isEmpty()) {
DeflatingDecompressor decompressor = ourDeflators.poll();
decompressor.reset(is, header);
return decompressor;
}
}
return new DeflatingDecompressor(is, header);
default:
throw new ZipException("Unsupported method of compression");
}
}
public int available() throws IOException {
return -1;
}
}

View file

@ -8,31 +8,31 @@ package org.amse.ys.zip;
import java.io.IOException;
public class LocalFileHeader {
static final int FILE_HEADER_SIGNATURE = 0x04034b50;
static final int FOLDER_HEADER_SIGNATURE = 0x02014b50;
static final int END_OF_CENTRAL_DIRECTORY_SIGNATURE = 0x06054b50;
static final int DATA_DESCRIPTOR_SIGNATURE = 0x08074b50;
static final int FILE_HEADER_SIGNATURE = 0x04034b50;
static final int FOLDER_HEADER_SIGNATURE = 0x02014b50;
static final int END_OF_CENTRAL_DIRECTORY_SIGNATURE = 0x06054b50;
static final int DATA_DESCRIPTOR_SIGNATURE = 0x08074b50;
int Signature;
int Version;
int Version;
int Flags;
int CompressionMethod;
int CompressionMethod;
int ModificationTime;
int ModificationDate;
int CRC32;
int CompressedSize;
int UncompressedSize;
int CompressedSize;
int UncompressedSize;
int NameLength;
int ExtraLength;
public String FileName;
int DataOffset;
LocalFileHeader() {
}
LocalFileHeader() {
}
void readFrom(MyBufferedInputStream stream) throws IOException {
void readFrom(MyBufferedInputStream stream) throws IOException {
Signature = stream.read4Bytes();
switch (Signature) {
default:
@ -40,26 +40,26 @@ public class LocalFileHeader {
case END_OF_CENTRAL_DIRECTORY_SIGNATURE:
{
stream.skip(16);
int comment = stream.read2Bytes();
int comment = stream.read2Bytes();
stream.skip(comment);
break;
}
case FOLDER_HEADER_SIGNATURE:
{
Version = stream.read4Bytes();
Flags = stream.read2Bytes();
CompressionMethod = stream.read2Bytes();
ModificationTime = stream.read2Bytes();
ModificationDate = stream.read2Bytes();
CRC32 = stream.read4Bytes();
CompressedSize = stream.read4Bytes();
UncompressedSize = stream.read4Bytes();
Version = stream.read4Bytes();
Flags = stream.read2Bytes();
CompressionMethod = stream.read2Bytes();
ModificationTime = stream.read2Bytes();
ModificationDate = stream.read2Bytes();
CRC32 = stream.read4Bytes();
CompressedSize = stream.read4Bytes();
UncompressedSize = stream.read4Bytes();
if (CompressionMethod == 0 && CompressedSize != UncompressedSize) {
CompressedSize = UncompressedSize;
}
NameLength = stream.read2Bytes();
ExtraLength = stream.read2Bytes();
int comment = stream.read2Bytes();
NameLength = stream.read2Bytes();
ExtraLength = stream.read2Bytes();
int comment = stream.read2Bytes();
stream.skip(12);
FileName = stream.readString(NameLength);
stream.skip(ExtraLength);
@ -67,19 +67,19 @@ public class LocalFileHeader {
break;
}
case FILE_HEADER_SIGNATURE:
Version = stream.read2Bytes();
Flags = stream.read2Bytes();
CompressionMethod = stream.read2Bytes();
ModificationTime = stream.read2Bytes();
ModificationDate = stream.read2Bytes();
CRC32 = stream.read4Bytes();
CompressedSize = stream.read4Bytes();
UncompressedSize = stream.read4Bytes();
Version = stream.read2Bytes();
Flags = stream.read2Bytes();
CompressionMethod = stream.read2Bytes();
ModificationTime = stream.read2Bytes();
ModificationDate = stream.read2Bytes();
CRC32 = stream.read4Bytes();
CompressedSize = stream.read4Bytes();
UncompressedSize = stream.read4Bytes();
if (CompressionMethod == 0 && CompressedSize != UncompressedSize) {
CompressedSize = UncompressedSize;
}
NameLength = stream.read2Bytes();
ExtraLength = stream.read2Bytes();
NameLength = stream.read2Bytes();
ExtraLength = stream.read2Bytes();
FileName = stream.readString(NameLength);
stream.skip(ExtraLength);
break;
@ -90,5 +90,5 @@ public class LocalFileHeader {
break;
}
DataOffset = stream.offset();
}
}
}

View file

@ -3,40 +3,40 @@ package org.amse.ys.zip;
import java.io.*;
public class NoCompressionDecompressor extends Decompressor {
private final LocalFileHeader myHeader;
private final MyBufferedInputStream myStream;
private int myCurrentPosition;
private final LocalFileHeader myHeader;
private final MyBufferedInputStream myStream;
private int myCurrentPosition;
public NoCompressionDecompressor(MyBufferedInputStream is, LocalFileHeader header) {
super();
myHeader = header;
myStream = is;
}
public NoCompressionDecompressor(MyBufferedInputStream is, LocalFileHeader header) {
super();
myHeader = header;
myStream = is;
}
public int read(byte b[], int off, int len) throws IOException {
int i = 0;
for (; i < len; ++i) {
int value = read();
if (value == -1) {
break;
}
if (b != null) {
b[off + i] = (byte)value;
public int read(byte b[], int off, int len) throws IOException {
int i = 0;
for (; i < len; ++i) {
int value = read();
if (value == -1) {
break;
}
}
return (i > 0) ? i : -1;
}
if (b != null) {
b[off + i] = (byte)value;
}
}
return (i > 0) ? i : -1;
}
public int read() throws IOException {
if (myCurrentPosition < myHeader.CompressedSize) {
myCurrentPosition++;
return myStream.read();
} else {
return -1;
}
}
public int available() throws IOException {
return (myHeader.UncompressedSize - myCurrentPosition);
}
public int read() throws IOException {
if (myCurrentPosition < myHeader.CompressedSize) {
myCurrentPosition++;
return myStream.read();
} else {
return -1;
}
}
public int available() throws IOException {
return (myHeader.UncompressedSize - myCurrentPosition);
}
}

View file

@ -4,7 +4,7 @@ import java.io.IOException;
@SuppressWarnings("serial")
public class ZipException extends IOException {
ZipException(String message) {
super(message);
}
ZipException(String message) {
super(message);
}
}

View file

@ -4,48 +4,48 @@ import java.io.*;
class ZipInputStream extends InputStream {
private final ZipFile myParent;
private final MyBufferedInputStream myBaseStream;
private final Decompressor myDecompressor;
private final MyBufferedInputStream myBaseStream;
private final Decompressor myDecompressor;
private boolean myIsClosed;
public ZipInputStream(ZipFile parent, LocalFileHeader header) throws IOException {
public ZipInputStream(ZipFile parent, LocalFileHeader header) throws IOException {
myParent = parent;
myBaseStream = parent.getBaseStream();
myBaseStream.setPosition(header.DataOffset);
myDecompressor = Decompressor.init(myBaseStream, header);
}
myBaseStream = parent.getBaseStream();
myBaseStream.setPosition(header.DataOffset);
myDecompressor = Decompressor.init(myBaseStream, header);
}
@Override
public int available() throws IOException {
return myDecompressor.available();
}
public int available() throws IOException {
return myDecompressor.available();
}
@Override
public int read(byte b[], int off, int len) throws IOException {
if (b == null) {
throw new NullPointerException();
} else if ((off < 0) || (off > b.length) || (len < 0) ||
((off + len) > b.length) || ((off + len) < 0)) {
throw new IndexOutOfBoundsException();
} else if (len == 0) {
return 0;
}
public int read(byte b[], int off, int len) throws IOException {
if (b == null) {
throw new NullPointerException();
} else if ((off < 0) || (off > b.length) || (len < 0) ||
((off + len) > b.length) || ((off + len) < 0)) {
throw new IndexOutOfBoundsException();
} else if (len == 0) {
return 0;
}
return myDecompressor.read(b, off, len);
}
return myDecompressor.read(b, off, len);
}
@Override
public int read() throws IOException {
return myDecompressor.read();
}
public int read() throws IOException {
return myDecompressor.read();
}
public void close() throws IOException {
public void close() throws IOException {
if (!myIsClosed) {
myIsClosed = true;
myParent.storeBaseStream(myBaseStream);
Decompressor.storeDecompressor(myDecompressor);
}
}
}
protected void finalize() throws Throwable {
try {

View file

@ -90,7 +90,7 @@ public abstract class DictionaryUtil {
ParagonInfoReader(Context context) {
myContext = context;
}
@Override
public boolean dontCacheAttributeValues() {
return true;
@ -238,7 +238,7 @@ public abstract class DictionaryUtil {
return intent.putExtra(dictionaryInfo.IntentKey, text);
} else {
return intent.setData(Uri.parse(text));
}
}
}
public static void openTextInDictionary(Activity activity, String text, boolean singleWord, int selectionTop, int selectionBottom) {
@ -277,7 +277,7 @@ public abstract class DictionaryUtil {
}
}
public static void openWordInDictionary(Activity activity, ZLTextWord word, ZLTextRegion region) {
public static void openWordInDictionary(Activity activity, ZLTextWord word, ZLTextRegion region) {
openTextInDictionary(
activity, word.toString(), true, region.getTop(), region.getBottom()
);

View file

@ -39,7 +39,7 @@ public class PopupWindow extends LinearLayout {
myActivity = activity;
setFocusable(false);
final LayoutInflater inflater =
(LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
inflater.inflate(
@ -84,7 +84,7 @@ public class PopupWindow extends LinearLayout {
}
});
}
public void addView(View view) {
((LinearLayout)findViewById(R.id.tools_plate)).addView(view);
}

View file

@ -38,7 +38,7 @@ public class SelectionShareAction extends FBAndroidAction {
final Intent intent = new Intent(android.content.Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(android.content.Intent.EXTRA_SUBJECT,
intent.putExtra(android.content.Intent.EXTRA_SUBJECT,
ZLResource.resource("selection").getResource("quoteFrom").getValue().replace("%s", title)
);
intent.putExtra(android.content.Intent.EXTRA_TEXT, text);

View file

@ -52,7 +52,7 @@ public class TOCActivity extends ListActivity {
final TOCTree root = fbreader.Model.TOCTree;
myAdapter = new TOCAdapter(root);
final ZLTextWordCursor cursor = fbreader.BookTextView.getStartCursor();
int index = cursor.getParagraphIndex();
int index = cursor.getParagraphIndex();
if (cursor.isEndOfParagraph()) {
++index;
}

View file

@ -143,12 +143,12 @@ public class BookInfoActivity extends Activity {
public static Intent intentByBook(Book book) {
return new Intent().putExtra(FBReader.BOOK_KEY, SerializerUtil.serialize(book));
}
public static Book bookByIntent(Intent intent) {
return intent != null ?
SerializerUtil.deserializeBook(intent.getStringExtra(FBReader.BOOK_KEY)) : null;
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
final Book book = bookByIntent(data);

View file

@ -83,7 +83,7 @@ public class BookCollectionShadow extends AbstractBookCollection implements Serv
myContext.unregisterReceiver(myReceiver);
myContext.unbindService(this);
myInterface = null;
myContext = null;
myContext = null;
}
}

View file

@ -271,7 +271,7 @@ public class AddCustomCatalogActivity extends Activity {
});
setErrorText(myError);
}
};
};
UIUtil.wait("loadingCatalogInfo", loadInfoRunnable, this);
}
}

View file

@ -64,7 +64,7 @@ public class BookDownloader extends Activity {
}
if (!intent.hasExtra(BookDownloaderService.SHOW_NOTIFICATIONS_KEY)) {
intent.putExtra(BookDownloaderService.SHOW_NOTIFICATIONS_KEY,
intent.putExtra(BookDownloaderService.SHOW_NOTIFICATIONS_KEY,
BookDownloaderService.Notifications.ALREADY_DOWNLOADING);
}
if ("epub".equals(uri.getScheme())) {

View file

@ -173,7 +173,7 @@ class SQLiteNetworkDatabase extends NetworkDatabase {
id = link.getId();
statement.bindLong(5, id);
statement.execute();
final Cursor linksCursor = myDatabase.rawQuery("SELECT key,url,mime,update_time FROM LinkUrls WHERE link_id = " + link.getId(), null);
while (linksCursor.moveToNext()) {
try {
@ -273,7 +273,7 @@ class SQLiteNetworkDatabase extends NetworkDatabase {
}
});
}
private void createTables() {
myDatabase.execSQL(
"CREATE TABLE CustomLinks(" +

View file

@ -72,7 +72,7 @@ public abstract class NetworkBookActions {
@Override
public boolean isEnabled(NetworkTree tree) {
return myId >= 0;
}
}
@Override
public String getContextLabel(NetworkTree tree) {

View file

@ -92,23 +92,23 @@ class AnimationSpeedPreference extends DialogPreference {
protected void onBoundsChange(Rect bounds) {
myBase.setBounds(bounds);
}
@Override
protected boolean onStateChange(int[] state) {
invalidateSelf();
return false;
}
@Override
public boolean isStateful() {
return true;
}
@Override
protected boolean onLevelChange(int level) {
return myBase.setLevel(level);
}
@Override
public void draw(Canvas canvas) {
myBase.draw(canvas);

View file

@ -35,7 +35,7 @@ class DictionaryPreference extends ZLStringListPreference {
super(context, resource, resourceKey);
myOption = dictionaryOption;
final String[] values = new String[infos.size()];
final String[] texts = new String[infos.size()];
int index = 0;

View file

@ -39,7 +39,7 @@ class WallpaperPreference extends ZLStringListPreference {
myOption = profile.WallpaperOption;
final List<ZLFile> predefined = WallpapersUtil.predefinedWallpaperFiles();
final List<ZLFile> external = WallpapersUtil.externalWallpaperFiles();
final int size = 1 + predefined.size() + external.size();
final String[] values = new String[size];
final String[] texts = new String[size];

View file

@ -126,7 +126,7 @@ class ZLColorPreference extends DialogPreference {
//colorView.setImageResource(R.drawable.fbreader);
final Drawable drawable = new ColorDrawable(0x00FF00);
colorView.setImageDrawable(drawable);
super.onBindView(view);
}
*/
@ -161,18 +161,18 @@ class ZLColorPreference extends DialogPreference {
protected void onBoundsChange(Rect bounds) {
myBase.setBounds(bounds);
}
@Override
protected boolean onStateChange(int[] state) {
invalidateSelf();
return false;
}
@Override
public boolean isStateful() {
return true;
}
@Override
protected boolean onLevelChange(int level) {
if (level < 4000) {
@ -182,7 +182,7 @@ class ZLColorPreference extends DialogPreference {
}
return myBase.setLevel(level);
}
@Override
public void draw(Canvas canvas) {
myBase.draw(canvas);

View file

@ -93,7 +93,7 @@ public class TipsActivity extends Activity {
finish();
}
});
final Button nextTipButton =
(Button)findViewById(R.id.tip_buttons).findViewById(R.id.cancel_button);
nextTipButton.setText(resource.getResource("more").getValue());
@ -103,7 +103,7 @@ public class TipsActivity extends Activity {
showTip(nextTipButton);
}
});
showTip(nextTipButton);
}
}

View file

@ -45,7 +45,7 @@ public abstract class UIUtil {
};
private static final Queue<Pair> ourTaskQueue = new LinkedList<Pair>();
private static volatile Handler ourProgressHandler;
private static boolean init() {
if (ourProgressHandler != null) {
return true;
@ -114,7 +114,7 @@ public abstract class UIUtil {
activity.runOnUiThread(new Runnable() {
public void run() {
final ProgressDialog progress = ProgressDialog.show(activity, null, message, true, false);
final Thread runner = new Thread() {
public void run() {
action.run();

View file

@ -27,7 +27,7 @@ public final class Author {
DisplayName = displayName;
SortKey = sortKey;
}
public static int hashCode(Author author) {
return author == null ? 0 : author.hashCode();
}

View file

@ -382,7 +382,7 @@ public class BookCollection extends AbstractBookCollection {
);
file.setCached(false);
}
// Step 4: add help file
try {
final ZLFile helpFile = getHelpFile();
@ -437,7 +437,7 @@ public class BookCollection extends AbstractBookCollection {
fileList.add(entry);
}
}
return fileList;
}

View file

@ -168,7 +168,7 @@ public final class FileInfoSet {
save();
}
return info.Id;
}
}
private ZLFile getFile(FileInfo info) {
if (info == null) {

View file

@ -211,7 +211,7 @@ class XMLSerializer extends AbstractSerializer {
}
private State myState = State.READ_NOTHING;
private long myId = -1;
private String myUrl;
private final StringBuilder myTitle = new StringBuilder();
@ -318,7 +318,7 @@ class XMLSerializer extends AbstractSerializer {
}
return false;
}
@Override
public boolean endElementHandler(String tag) {
switch (myState) {
@ -327,7 +327,7 @@ class XMLSerializer extends AbstractSerializer {
case READ_ENTRY:
if ("entry".equals(tag)) {
myState = State.READ_NOTHING;
}
}
break;
case READ_AUTHOR_URI:
case READ_AUTHOR_NAME:
@ -347,7 +347,7 @@ class XMLSerializer extends AbstractSerializer {
}
return false;
}
@Override
public void characterDataHandler(char[] ch, int start, int length) {
switch (myState) {
@ -391,7 +391,7 @@ class XMLSerializer extends AbstractSerializer {
private State myState = State.READ_NOTHING;
private Bookmark myBookmark;
private long myId = -1;
private long myBookId;
private String myBookTitle;
@ -496,7 +496,7 @@ class XMLSerializer extends AbstractSerializer {
}
return false;
}
@Override
public boolean endElementHandler(String tag) {
switch (myState) {
@ -505,14 +505,14 @@ class XMLSerializer extends AbstractSerializer {
case READ_BOOKMARK:
if ("bookmark".equals(tag)) {
myState = State.READ_NOTHING;
}
}
break;
case READ_TEXT:
myState = State.READ_BOOKMARK;
}
return false;
}
@Override
public void characterDataHandler(char[] ch, int start, int length) {
if (myState == State.READ_TEXT) {

View file

@ -46,11 +46,11 @@ public class TOCTree extends ZLTree<TOCTree> {
myText = null;
}
}
public Reference getReference() {
return myReference;
}
public void setReference(ZLTextModel model, int reference) {
myReference = new Reference(reference, model);
}
@ -58,7 +58,7 @@ public class TOCTree extends ZLTree<TOCTree> {
public static class Reference {
public final int ParagraphIndex;
public final ZLTextModel Model;
public Reference(final int paragraphIndex, final ZLTextModel model) {
ParagraphIndex = paragraphIndex;
Model = model;

View file

@ -35,29 +35,29 @@ public class TapZoneMap {
ourPredefinedMaps.add("left_to_right");
ourPredefinedMaps.add("down");
ourPredefinedMaps.add("up");
ourMapsOption = new ZLStringListOption("TapZones", "List", ourPredefinedMaps, "\000");
ourMapsOption = new ZLStringListOption("TapZones", "List", ourPredefinedMaps, "\000");
}
private static final Map<String,TapZoneMap> ourMaps = new HashMap<String,TapZoneMap>();
public static List<String> zoneMapNames() {
return ourMapsOption.getValue();
return ourMapsOption.getValue();
}
public static TapZoneMap zoneMap(String name) {
TapZoneMap map = ourMaps.get(name);
TapZoneMap map = ourMaps.get(name);
if (map == null) {
map = new TapZoneMap(name);
map = new TapZoneMap(name);
ourMaps.put(name, map);
}
}
return map;
}
public static TapZoneMap createZoneMap(String name, int width, int height) {
if (ourMapsOption.getValue().contains(name)) {
return null;
return null;
}
final TapZoneMap map = zoneMap(name);
final TapZoneMap map = zoneMap(name);
map.myWidth.setValue(width);
map.myHeight.setValue(height);
final List<String> lst = new LinkedList<String>(ourMapsOption.getValue());
@ -68,10 +68,10 @@ public class TapZoneMap {
public static void deleteZoneMap(String name) {
if (ourPredefinedMaps.contains(name)) {
return;
return;
}
ourMaps.remove(name);
ourMaps.remove(name);
final List<String> lst = new LinkedList<String>(ourMapsOption.getValue());
lst.remove(name);
@ -84,15 +84,15 @@ public class TapZoneMap {
doubleTap
};
public final String Name;
private final String myOptionGroupName;
public final String Name;
private final String myOptionGroupName;
private ZLIntegerRangeOption myHeight;
private ZLIntegerRangeOption myWidth;
private final HashMap<Zone,ZLStringOption> myZoneMap = new HashMap<Zone,ZLStringOption>();
private final HashMap<Zone,ZLStringOption> myZoneMap2 = new HashMap<Zone,ZLStringOption>();
private TapZoneMap(String name) {
Name = name;
Name = name;
myOptionGroupName = "TapZones:" + name;
myHeight = new ZLIntegerRangeOption(myOptionGroupName, "Height", 2, 5, 3);
myWidth = new ZLIntegerRangeOption(myOptionGroupName, "Width", 2, 5, 3);
@ -103,15 +103,15 @@ public class TapZoneMap {
}
public boolean isCustom() {
return !ourPredefinedMaps.contains(Name);
return !ourPredefinedMaps.contains(Name);
}
public int getHeight() {
return myHeight.getValue();
return myHeight.getValue();
}
public int getWidth() {
return myWidth.getValue();
return myWidth.getValue();
}
public String getActionByCoordinates(int x, int y, int width, int height, Tap tap) {
@ -126,40 +126,40 @@ public class TapZoneMap {
return option != null ? option.getValue() : null;
}
private ZLStringOption getOptionByZone(Zone zone, Tap tap) {
private ZLStringOption getOptionByZone(Zone zone, Tap tap) {
switch (tap) {
default:
return null;
default:
return null;
case singleTap:
{
{
final ZLStringOption option = myZoneMap.get(zone);
return option != null ? option : myZoneMap2.get(zone);
}
return option != null ? option : myZoneMap2.get(zone);
}
case singleNotDoubleTap:
return myZoneMap.get(zone);
case doubleTap:
return myZoneMap2.get(zone);
}
}
}
private ZLStringOption createOptionForZone(Zone zone, boolean singleTap, String action) {
return new ZLStringOption(
myOptionGroupName,
private ZLStringOption createOptionForZone(Zone zone, boolean singleTap, String action) {
return new ZLStringOption(
myOptionGroupName,
(singleTap ? "Action" : "Action2") + ":" + zone.HIndex + ":" + zone.VIndex,
action
);
}
action
);
}
public void setActionForZone(int h, int v, boolean singleTap, String action) {
public void setActionForZone(int h, int v, boolean singleTap, String action) {
final Zone zone = new Zone(h, v);
final HashMap<Zone,ZLStringOption> map = singleTap ? myZoneMap : myZoneMap2;
ZLStringOption option = map.get(zone);
if (option == null) {
option = createOptionForZone(zone, singleTap, null);
map.put(zone, option);
}
option.setValue(action);
}
final HashMap<Zone,ZLStringOption> map = singleTap ? myZoneMap : myZoneMap2;
ZLStringOption option = map.get(zone);
if (option == null) {
option = createOptionForZone(zone, singleTap, null);
map.put(zone, option);
}
option.setValue(action);
}
private static class Zone {
int HIndex;
@ -202,9 +202,9 @@ public class TapZoneMap {
try {
if ("zone".equals(tag)) {
final Zone zone = new Zone(
Integer.parseInt(attributes.getValue("x")),
Integer.parseInt(attributes.getValue("y"))
);
Integer.parseInt(attributes.getValue("x")),
Integer.parseInt(attributes.getValue("y"))
);
final String action = attributes.getValue("action");
final String action2 = attributes.getValue("action2");
if (action != null) {

View file

@ -37,7 +37,7 @@ final class Base64EncodedImage extends ZLBase64EncodedImage {
private final int myFileNumber;
private final String myNamePostfix;
private OutputStreamWriter myStreamWriter;
public Base64EncodedImage(MimeType mimeType, String namePostfix) {
// TODO: use contentType
super(mimeType);

View file

@ -33,11 +33,11 @@ public class FB2AnnotationReader extends ZLXMLReaderAdapter {
public FB2AnnotationReader() {
}
public boolean dontCacheAttributeValues() {
return true;
}
public String readAnnotation(ZLFile file) {
myReadState = READ_NOTHING;
myBuffer.delete(0, myBuffer.length());
@ -69,7 +69,7 @@ public class FB2AnnotationReader extends ZLXMLReaderAdapter {
}
return false;
}
public boolean endElementHandler(String tag) {
if (myReadState != READ_ANNOTATION) {
return false;
@ -87,7 +87,7 @@ public class FB2AnnotationReader extends ZLXMLReaderAdapter {
}
return false;
}
public void characterDataHandler(char[] data, int start, int length) {
if (myReadState == READ_ANNOTATION) {
myBuffer.append(new String(data, start, length).trim());

View file

@ -110,7 +110,7 @@ class FB2CoverImage extends ZLImageProxy {
return true;
}
break;
}
}
return false;
}

View file

@ -48,7 +48,7 @@ final class FB2Tag {
public static final byte IMAGE = 23;
public static final byte BINARY = 24;
public static final byte FICTIONBOOK = 25;
public static final byte TITLE_INFO = 26;
public static final byte BOOK_TITLE = 27;
public static final byte AUTHOR = 28;
@ -65,7 +65,7 @@ final class FB2Tag {
private static final HashMap<String, Byte> ourTagByName = new HashMap<String, Byte>(256, 0.2f);
private static final Byte ourUnknownTag;
static {
static {
ourTagByName.put("unknown", UNKNOWN);
ourUnknownTag = (Byte)ourTagByName.get("unknown");
ourTagByName.put("p", P);

View file

@ -67,10 +67,10 @@ public class HtmlReader extends BookReader implements ZLHtmlReader {
private int myOLCounter = 0;
private byte[] myControls = new byte[10];
private byte myControlsNumber = 0;
public HtmlReader(BookModel model) throws UnsupportedEncodingException {
super(model);
try {
try {
//String encoding = model.Book.getEncoding();
myAttributeDecoder = createDecoder();
setByteDecoder(createDecoder());
@ -138,7 +138,7 @@ public class HtmlReader extends BookReader implements ZLHtmlReader {
}
myControls[myControlsNumber++] = control;
}
private void closeControl(byte control) {
for (int i = 0; i < myControlsNumber; i++) {
addControl(myControls[i], false);
@ -161,12 +161,12 @@ public class HtmlReader extends BookReader implements ZLHtmlReader {
myControls[i] = myControls[i + 1];
}
}
private void startNewParagraph() {
endParagraph();
beginParagraph(ZLTextParagraph.Kind.TEXT_PARAGRAPH);
}
public final void endElementHandler(String tagName) {
endElementHandler(HtmlTag.getTagByName(tagName));
}
@ -201,7 +201,7 @@ public class HtmlReader extends BookReader implements ZLHtmlReader {
case HtmlTag.HTML:
//unsetCurrentTextModel();
break;
case HtmlTag.B:
case HtmlTag.S:
case HtmlTag.SUB:
@ -219,11 +219,11 @@ public class HtmlReader extends BookReader implements ZLHtmlReader {
myOrderedListIsStarted = false;
myOLCounter = 0;
break;
case HtmlTag.UL:
//myUnorderedListIsStarted = false;
break;
default:
break;
}
@ -271,7 +271,7 @@ public class HtmlReader extends BookReader implements ZLHtmlReader {
}
break;
}
case HtmlTag.IMG: {
/*
String ref = attributes.getStringValue(mySrcAttribute, myAttributeDecoder);
@ -287,7 +287,7 @@ public class HtmlReader extends BookReader implements ZLHtmlReader {
*/
break;
}
case HtmlTag.B:
case HtmlTag.S:
case HtmlTag.SUB:
@ -301,7 +301,7 @@ public class HtmlReader extends BookReader implements ZLHtmlReader {
case HtmlTag.I:
openControl(myStyleTable[tag]);
break;
case HtmlTag.H1:
case HtmlTag.H2:
case HtmlTag.H3:
@ -311,15 +311,15 @@ public class HtmlReader extends BookReader implements ZLHtmlReader {
startNewParagraph();
openControl(myStyleTable[tag]);
break;
case HtmlTag.OL:
myOrderedListIsStarted = true;
break;
case HtmlTag.UL:
//myUnorderedListIsStarted = true;
break;
case HtmlTag.LI:
startNewParagraph();
if (myOrderedListIsStarted) {
@ -330,14 +330,14 @@ public class HtmlReader extends BookReader implements ZLHtmlReader {
addData(new char[] {'*', ' '});
}
break;
case HtmlTag.SCRIPT:
case HtmlTag.SELECT:
case HtmlTag.STYLE:
endParagraph();
break;
case HtmlTag.TR:
case HtmlTag.TR:
case HtmlTag.BR:
startNewParagraph();
break;

View file

@ -48,7 +48,7 @@ public final class HtmlTag {
public static final byte DIV = 23;
public static final byte TR = 24;
public static final byte STYLE = 25;
public static final byte S = 26;
public static final byte SUB = 27;
public static final byte SUP = 28;
@ -59,13 +59,13 @@ public final class HtmlTag {
public static final byte CITE = 33;
public static final byte HR = 34;
// mobipocket specific tags
public static final byte REFERENCE = 35;
public static final byte GUIDE = 36;
public static final byte TAG_NUMBER = 37;
private static final HashMap<String,Byte> ourTagByName = new HashMap<String,Byte>(256, 0.2f);
private static final Byte ourUnknownTag;

View file

@ -131,7 +131,7 @@ class NCXReader extends ZLXMLReaderAdapter {
}
return false;
}
@Override
public boolean endElementHandler(String tag) {
tag = tag.toLowerCase().intern();
@ -166,7 +166,7 @@ class NCXReader extends ZLXMLReaderAdapter {
}
return false;
}
@Override
public void characterDataHandler(char[] ch, int start, int length) {
if (myReadState == READ_TEXT) {

View file

@ -206,7 +206,7 @@ class OEBBookReader extends ZLXMLReaderAdapter implements XMLNamespaces {
private static final int READ_SPINE = 2;
private static final int READ_GUIDE = 3;
private static final int READ_TOUR = 4;
private int myState;
@Override

View file

@ -34,7 +34,7 @@ class OEBMetaInfoReader extends ZLXMLReaderAdapter implements XMLNamespaces {
private String mySeriesTitle = "";
private String mySeriesIndex = null;
private final ArrayList<String> myAuthorList = new ArrayList<String>();
private final ArrayList<String> myAuthorList2 = new ArrayList<String>();

View file

@ -88,7 +88,7 @@ public class MobipocketPlugin extends JavaFormatPlugin {
if (index != -1) {
author = author.substring(index + 1).trim() +
' ' +
author.substring(0, index).trim();
author.substring(0, index).trim();
} else {
author = author.trim();
}
@ -228,7 +228,7 @@ public class MobipocketPlugin extends JavaFormatPlugin {
return new ZLFileImage(MimeType.IMAGE_AUTO, file, ZLFileImage.ENCODING_NONE, start, len);
}
}
return null;
return null;
} catch (IOException e) {
return null;
} finally {

View file

@ -79,7 +79,7 @@ abstract class PalmDocLikeStream extends PdbStream {
}
myBufferOffset = 0;
}
return true;
}
}

View file

@ -37,7 +37,7 @@ public class PdbHeader {
Flags = PdbUtil.readShort(stream);
PdbUtil.skip(stream, 26);
if (stream.read(buffer, 0, 8) != 8) {
throw new IOException("PdbHeader: cannot reader palm id");
}

View file

@ -43,7 +43,7 @@ public abstract class PdbStream extends InputStream {
myBufferLength = 0;
myBufferOffset = 0;
}
public int read() {
if (!fillBuffer()) {
return -1;
@ -68,7 +68,7 @@ public abstract class PdbStream extends InputStream {
}
return (realSize > 0) ? realSize : -1;
}
public void close() throws IOException {
if (myBase != null) {
myBase.close();

View file

@ -220,7 +220,7 @@ public class XHTMLReader extends ZLXMLReaderAdapter {
@Override
public void characterDataHandler(char[] data, int start, int len) {
if (myPreformatted) {
final char first = data[start];
final char first = data[start];
if ((first == '\r') || (first == '\n')) {
myModelReader.addControl(FBTextKind.CODE, false);
myModelReader.endParagraph();

View file

@ -175,7 +175,7 @@ public class FileTree extends LibraryTree {
final boolean isDir = file0.isDirectory();
if (isDir != file1.isDirectory()) {
return isDir ? -1 : 1;
}
}
return file0.getShortName().compareToIgnoreCase(file1.getShortName());
}
};

View file

@ -430,7 +430,7 @@ public final class Library {
);
file.setCached(false);
}
// Step 4: add help file
try {
final ZLFile helpFile = getHelpFile();
@ -521,7 +521,7 @@ public final class Library {
fireModelChangedEvent(ChangeListener.Code.Found);
return;
}
FirstLevelTree newSearchResults = null;
final List<Book> booksCopy;
synchronized (myBooks) {

View file

@ -40,7 +40,7 @@ public class NetworkBookItem extends NetworkItem {
public final String SortKey;
/**
* Creates new AuthorData instance.
* Creates new AuthorData instance.
*
* @param displayName author's name. Must be not <code>null</code>.
* @param sortKey string that defines sorting order of book's authors.

View file

@ -42,7 +42,7 @@ public final class NetworkBookItemComparator implements Comparator<NetworkItem>
final LinkedList<NetworkBookItem.AuthorData> authors0 = book0.Authors;
final LinkedList<NetworkBookItem.AuthorData> authors1 = book1.Authors;
final boolean authors0empty = authors0.size() == 0;
final boolean authors1empty = authors1.size() == 0;

View file

@ -67,7 +67,7 @@ public abstract class NetworkCatalogItem extends NetworkItem {
* @param summary description of this library item. Can be <code>null</code>.
* @param urls collection of item-related URLs. Can be <code>null</code>.
* @param accessibility value defines when this library item will be accessible
* in the network library view.
* in the network library view.
* @param flags describes how to show book items inside this catalog
*/
public NetworkCatalogItem(INetworkLink link, CharSequence title, CharSequence summary, UrlInfoCollection<?> urls, Accessibility accessibility, int flags) {
@ -135,10 +135,10 @@ public abstract class NetworkCatalogItem extends NetworkItem {
/**
* Performs all necessary operations with NetworkOperationData and NetworkRequest
* to complete loading children items.
*
*
* @param data Network operation data instance
* @param networkRequest initial network request
*
*
* @throws ZLNetworkException when network operation couldn't be completed
*/
protected final void doLoadChildren(NetworkOperationData data, ZLNetworkRequest networkRequest) throws ZLNetworkException {

View file

@ -33,7 +33,7 @@ public abstract class NetworkURLCatalogItem extends NetworkCatalogItem {
* @param summary description of this library item. Can be <code>null</code>.
* @param urls collection of item-related URLs. Can be <code>null</code>.
* @param accessibility value defines when this library item will be accessible
* in the network library view.
* in the network library view.
* @param flags value defines how to show book items in this catalog.
*/
protected NetworkURLCatalogItem(INetworkLink link, CharSequence title, CharSequence summary, UrlInfoCollection<?> urls, Accessibility accessibility, int flags) {

View file

@ -26,14 +26,14 @@ import org.geometerplus.fbreader.network.atom.*;
public abstract class AbstractATOMFeedHandler implements ATOMFeedHandler {
public void processFeedStart() {
}
public void processFeedEnd() {
}
public boolean processFeedMetadata(ATOMFeedMetadata feed, boolean beforeEntries) {
return false;
}
public boolean processFeedEntry(ATOMEntry entry) {
return false;
}

View file

@ -172,7 +172,7 @@ public class LitResBookshelfItem extends NetworkURLCatalogItem {
final LitResAuthenticationManager mgr =
(LitResAuthenticationManager)Link.authenticationManager();
// TODO: Maybe it's better to call isAuthorised(true) directly
// TODO: Maybe it's better to call isAuthorised(true) directly
// and let exception fly through???
if (!mgr.mayBeAuthorised(true)) {
throw new ZLNetworkException(NetworkException.ERROR_AUTHENTICATION_FAILED);

View file

@ -112,7 +112,7 @@ class LitResXMLReader extends LitResAuthenticationXMLReader {
myUrls.addInfo(new UrlInfo(
UrlInfo.Type.Image, attributes.getValue("cover_preview"), MimeType.IMAGE_AUTO
));
myUrls.addInfo(new BookUrlInfo(
UrlInfo.Type.BookConditional,
BookUrlInfo.Format.FB2_ZIP,
@ -197,7 +197,7 @@ class LitResXMLReader extends LitResAuthenticationXMLReader {
break;
case BOOK:
if (TAG_BOOK == tag) {
myUrls.addInfo(new UrlInfo(
myUrls.addInfo(new UrlInfo(
UrlInfo.Type.SingleEntry,
"http://data.fbreader.org/catalogs/litres2/full.php5?id=" + myBookId,
MimeType.APP_ATOM_XML_ENTRY
@ -216,7 +216,7 @@ class LitResXMLReader extends LitResAuthenticationXMLReader {
myIndexInSeries,
myUrls
));
myBookId = myTitle = /*myLanguage = myDate = */mySeriesTitle = null;
mySummary = null;
myIndexInSeries = 0;
@ -285,7 +285,7 @@ class LitResXMLReader extends LitResAuthenticationXMLReader {
LitResGenreMap::Instance().genresMap();
const std::map<shared_ptr<LitResGenre>,std::string> &genresTitles =
LitResGenreMap::Instance().genresTitles();
std::map<std::string, shared_ptr<LitResGenre> >::const_iterator it = genresMap.find(myBuffer);
if (it != genresMap.end()) {
std::map<shared_ptr<LitResGenre>, std::string>::const_iterator jt = genresTitles.find(it->second);

View file

@ -45,7 +45,7 @@ class OPDSFeedHandler extends AbstractOPDSFeedHandler implements OPDSConstants {
* Creates new OPDSFeedHandler instance that can be used to get NetworkItem objects from OPDS feeds.
*
* @param baseURL string that contains URL of the OPDS feed, that will be read using this instance of the reader
* @param result network results buffer. Must be created using OPDSNetworkLink corresponding to the OPDS feed,
* @param result network results buffer. Must be created using OPDSNetworkLink corresponding to the OPDS feed,
* that will be read using this instance of the reader.
*/
OPDSFeedHandler(String baseURL, OPDSCatalogItem.State result) {

View file

@ -39,7 +39,7 @@ class OPDSLinkXMLReader extends OPDSXMLReader implements OPDSConstants {
private String myAuthenticationType;
private final LinkedList<URLRewritingRule> myUrlRewritingRules = new LinkedList<URLRewritingRule>();
private final HashMap<RelationAlias, String> myRelationAliases = new HashMap<RelationAlias, String>();
private final LinkedHashMap<String,String> myExtraData = new LinkedHashMap<String,String>();
private final LinkedHashMap<String,String> myExtraData = new LinkedHashMap<String,String>();
List<INetworkLink> links() {
return myLinks;
}
@ -124,7 +124,7 @@ class OPDSLinkXMLReader extends OPDSXMLReader implements OPDSConstants {
if (siteName != null && title != null && infos.getInfo(UrlInfo.Type.Catalog) != null) {
myLinks.add(link(id, siteName, title, summary, language, infos));
}
return false;
return false;
}
private INetworkLink link(

View file

@ -103,7 +103,7 @@ public abstract class OPDSNetworkLink extends AbstractNetworkLink {
).read(inputStream);
if (result.Loader.confirmInterruption() && result.LastLoadedId != null) {
// reset state to load current page from the beginning
// reset state to load current page from the beginning
result.LastLoadedId = null;
} else {
result.Loader.getTree().confirmAllItems();

View file

@ -22,7 +22,7 @@ package org.geometerplus.fbreader.tips;
public class Tip {
public final CharSequence Title;
public final CharSequence Content;
Tip(CharSequence title, CharSequence content) {
Title = title;
Content = content;

View file

@ -153,7 +153,7 @@ public abstract class ZLApplication {
public final boolean hasActionForKey(int key, boolean longPress) {
final String actionId = keyBindings().getBinding(key, longPress);
return actionId != null && !NoAction.equals(actionId);
return actionId != null && !NoAction.equals(actionId);
}
public final boolean runActionByKey(int key, boolean longPress) {
@ -282,7 +282,7 @@ public abstract class ZLApplication {
addTimerTaskInternal(runnable, periodMilliseconds);
}
}
}
}
public final void removeTimerTask(Runnable runnable) {
synchronized (myTimerLock) {

View file

@ -38,7 +38,7 @@ abstract public class ZLApplicationWindow {
abstract protected void processException(Exception e);
abstract protected void refresh();
abstract protected ZLViewWidget getViewWidget();
abstract protected void close();

View file

@ -34,7 +34,7 @@ abstract class FilteredEncodingCollection extends EncodingCollection {
ZLResourceFile.createResourceFile("encodings/Encodings.xml")
);
}
public abstract boolean isEncodingSupported(String name);
@Override

View file

@ -56,9 +56,9 @@ public abstract class ZLArchiveEntryFile extends ZLFile {
}
entryName = normalizeEntryName(entryName);
switch (archive.myArchiveType & ArchiveType.ARCHIVE) {
case ArchiveType.ZIP:
case ArchiveType.ZIP:
return new ZLZipEntryFile(archive, entryName);
case ArchiveType.TAR:
case ArchiveType.TAR:
return new ZLTarEntryFile(archive, entryName);
default:
return null;
@ -78,23 +78,23 @@ public abstract class ZLArchiveEntryFile extends ZLFile {
protected final ZLFile myParent;
protected final String myName;
protected ZLArchiveEntryFile(ZLFile parent, String name) {
myParent = parent;
myName = name;
init();
}
@Override
public boolean isDirectory() {
return false;
}
@Override
public String getPath() {
return myParent.getPath() + ":" + myName;
}
@Override
public String getLongName() {
return myName;

View file

@ -34,7 +34,7 @@ public abstract class ZLFile {
int TAR = 0x0200;
int ARCHIVE = 0xff00;
};
private String myExtension;
private String myShortName;
protected int myArchiveType;
@ -72,7 +72,7 @@ public abstract class ZLFile {
}
myArchiveType = archiveType;
}
public static ZLFile createFile(ZLFile parent, String name) {
ZLFile file = null;
if (parent == null) {
@ -151,9 +151,9 @@ public abstract class ZLFile {
}
public final boolean isCompressed() {
return (0 != (myArchiveType & ArchiveType.COMPRESSED));
return (0 != (myArchiveType & ArchiveType.COMPRESSED));
}
public final boolean isArchive() {
return (0 != (myArchiveType & ArchiveType.ARCHIVE));
}

View file

@ -31,17 +31,17 @@ public abstract class ZLResourceFile extends ZLFile {
}
private final String myPath;
protected ZLResourceFile(String path) {
myPath = path;
init();
}
@Override
public String getPath() {
return myPath;
}
@Override
public String getLongName() {
return myPath.substring(myPath.lastIndexOf('/') + 1);

View file

@ -50,7 +50,7 @@ class ZLTarHeader {
if (stream.skip(24) != 24) {
return false;
}
final byte[] fileSizeString = new byte[12];
if (stream.read(fileSizeString) != 12) {
return false;
@ -64,7 +64,7 @@ class ZLTarHeader {
Size *= 8;
Size += digit - (byte)'0';
}
if (stream.skip(20) != 20) {
return false;
}
@ -73,12 +73,12 @@ class ZLTarHeader {
if (linkFlag == -1) {
return false;
}
IsRegularFile = (linkFlag == 0) || (linkFlag == (byte)'0');
IsRegularFile = linkFlag == 0 || linkFlag == (byte)'0';
stream.skip(355);
if (((linkFlag == (byte)'L') ||
(linkFlag == (byte)'K')) && (Name == "././@LongLink") && (Size < 10240)) {
if ((linkFlag == (byte)'L' || linkFlag == (byte)'K')
&& "././@LongLink".equals(Name) && Size < 10240) {
final byte[] nameBuffer = new byte[Size - 1];
stream.read(nameBuffer);
Name = getStringFromByteArray(nameBuffer);

View file

@ -107,7 +107,7 @@ public final class ZLByteBuffer {
public boolean equalsToLCString(String lcPattern) {
return (myLength == lcPattern.length()) &&
lcPattern.equals(new String(myData, 0, myLength).toLowerCase());
}
}
private static final Object myConverterLock = new Object();
private static char[] myConverterBuffer = new char[20];

View file

@ -46,7 +46,7 @@ final class ZLHtmlParser {
private static final byte D_ATTRIBUTE_VALUE = 18;
private static final byte SCRIPT = 19;
private static final byte ENTITY_REF = 20;
private static ZLByteBuffer unique(HashMap<ZLByteBuffer,ZLByteBuffer> strings, ZLByteBuffer container) {
ZLByteBuffer s = strings.get(container);
if (s == null) {
@ -79,7 +79,7 @@ final class ZLHtmlParser {
//boolean html = false;
int bufferOffset = 0;
int offset = 0;
byte state = START_DOCUMENT;
while (true) {
final int count = stream.read(buffer);
@ -92,7 +92,7 @@ final class ZLHtmlParser {
int startPosition = 0;
try {
for (int i = -1;;) {
mainSwitchLabel:
mainSwitchLabel:
switch (state) {
case START_DOCUMENT:
while (buffer[++i] != '<') {}
@ -156,7 +156,7 @@ mainSwitchLabel:
break mainSwitchLabel;
}
}
case COMMENT :
while (true) {
switch (buffer[++i]) {
@ -269,7 +269,7 @@ mainSwitchLabel:
break;
}
break;
case WS_AFTER_END_TAG_NAME:
switch (buffer[++i]) {
case '>':
@ -289,7 +289,7 @@ mainSwitchLabel:
break;
}
break;
case ATTRIBUTE_NAME:
while (true) {
switch (buffer[++i]) {
@ -324,7 +324,7 @@ mainSwitchLabel:
break;
case '\t' :
break;
case '\n' :
case '\n' :
break;
case '\'':
state = S_ATTRIBUTE_VALUE;
@ -343,7 +343,7 @@ mainSwitchLabel:
case DEFAULT_ATTRIBUTE_VALUE:
while (true) {
i++;
if ((buffer[i] == ' ') || (buffer[i] == '\'')
if ((buffer[i] == ' ') || (buffer[i] == '\'')
|| (buffer[i] == '"') || (buffer[i] == '>')) {
attributeValue.append(buffer, startPosition, i - startPosition);
attributes.put(unique(strings, attributeName), new ZLByteBuffer(attributeValue));
@ -360,7 +360,7 @@ mainSwitchLabel:
break mainSwitchLabel;
case '>':
ZLByteBuffer stringTagName = unique(strings, tagName);
processStartTag(htmlReader, stringTagName, offset, attributes);
if (stringTagName.equalsToLCString("script")) {
scriptOpened = true;
@ -371,7 +371,7 @@ mainSwitchLabel:
startPosition = i + 1;
break mainSwitchLabel;
}
}
}
case D_ATTRIBUTE_VALUE:
while (true) {
switch (buffer[++i]) {
@ -383,7 +383,7 @@ mainSwitchLabel:
break mainSwitchLabel;
}
}
case S_ATTRIBUTE_VALUE:
while (true) {
switch (buffer[++i]) {

View file

@ -25,111 +25,111 @@ import org.geometerplus.zlibrary.core.filesystem.ZLFile;
import org.geometerplus.zlibrary.core.util.*;
public class ZLFileImage extends ZLSingleImage {
public static final String SCHEME = "imagefile";
public static final String SCHEME = "imagefile";
public static final String ENCODING_NONE = "";
public static final String ENCODING_HEX = "hex";
public static final String ENCODING_BASE64 = "base64";
public static final String ENCODING_NONE = "";
public static final String ENCODING_HEX = "hex";
public static final String ENCODING_BASE64 = "base64";
public static ZLFileImage byUrlPath(String urlPath) {
try {
final String[] data = urlPath.split("\000");
int count = Integer.parseInt(data[2]);
int[] offsets = new int[count];
int[] lengths = new int[count];
for (int i = 0; i < count; ++i) {
offsets[i] = Integer.parseInt(data[3 + i]);
lengths[i] = Integer.parseInt(data[3 + count + i]);
}
return new ZLFileImage(
MimeType.IMAGE_AUTO,
ZLFile.createFileByPath(data[0]),
data[1],
offsets,
lengths
);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
public static ZLFileImage byUrlPath(String urlPath) {
try {
final String[] data = urlPath.split("\000");
int count = Integer.parseInt(data[2]);
int[] offsets = new int[count];
int[] lengths = new int[count];
for (int i = 0; i < count; ++i) {
offsets[i] = Integer.parseInt(data[3 + i]);
lengths[i] = Integer.parseInt(data[3 + count + i]);
}
return new ZLFileImage(
MimeType.IMAGE_AUTO,
ZLFile.createFileByPath(data[0]),
data[1],
offsets,
lengths
);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
private final ZLFile myFile;
private final String myEncoding;
private final int[] myOffsets;
private final int[] myLengths;
private final ZLFile myFile;
private final String myEncoding;
private final int[] myOffsets;
private final int[] myLengths;
public ZLFileImage(String mimeType, ZLFile file, String encoding, int[] offsets, int[] lengths) {
this(MimeType.get(mimeType), file, encoding, offsets, lengths);
}
public ZLFileImage(String mimeType, ZLFile file, String encoding, int[] offsets, int[] lengths) {
this(MimeType.get(mimeType), file, encoding, offsets, lengths);
}
public ZLFileImage(MimeType mimeType, ZLFile file, String encoding, int[] offsets, int[] lengths) {
super(mimeType);
myFile = file;
myEncoding = encoding != null ? encoding : ENCODING_NONE;
myOffsets = offsets;
myLengths = lengths;
}
public ZLFileImage(MimeType mimeType, ZLFile file, String encoding, int[] offsets, int[] lengths) {
super(mimeType);
myFile = file;
myEncoding = encoding != null ? encoding : ENCODING_NONE;
myOffsets = offsets;
myLengths = lengths;
}
public ZLFileImage(String mimeType, ZLFile file, String encoding, int offset, int length) {
this(MimeType.get(mimeType), file, encoding, offset, length);
}
public ZLFileImage(String mimeType, ZLFile file, String encoding, int offset, int length) {
this(MimeType.get(mimeType), file, encoding, offset, length);
}
public ZLFileImage(MimeType mimeType, ZLFile file, String encoding, int offset, int length) {
super(mimeType);
myFile = file;
myEncoding = encoding != null ? encoding : ENCODING_NONE;
myOffsets = new int[1];
myLengths = new int[1];
myOffsets[0] = offset;
myLengths[0] = length;
}
public ZLFileImage(MimeType mimeType, ZLFile file, String encoding, int offset, int length) {
super(mimeType);
myFile = file;
myEncoding = encoding != null ? encoding : ENCODING_NONE;
myOffsets = new int[1];
myLengths = new int[1];
myOffsets[0] = offset;
myLengths[0] = length;
}
public ZLFileImage(MimeType mimeType, ZLFile file) {
this(mimeType, file, ENCODING_NONE, 0, (int)file.size());
}
public ZLFileImage(MimeType mimeType, ZLFile file) {
this(mimeType, file, ENCODING_NONE, 0, (int)file.size());
}
public String getURI() {
String result = SCHEME + "://" + myFile.getPath() + "\000" + myEncoding + "\000" + myOffsets.length;
for (int offset : myOffsets) {
result += "\000" + offset;
}
for (int length : myLengths) {
result += "\000" + length;
}
return result;
}
public String getURI() {
String result = SCHEME + "://" + myFile.getPath() + "\000" + myEncoding + "\000" + myOffsets.length;
for (int offset : myOffsets) {
result += "\000" + offset;
}
for (int length : myLengths) {
result += "\000" + length;
}
return result;
}
@Override
public InputStream inputStream() {
try {
final InputStream stream;
if (myOffsets.length == 1) {
final int offset = myOffsets[0];
final int length = myLengths[0];
stream = new SliceInputStream(myFile.getInputStream(), offset, length != 0 ? length : Integer.MAX_VALUE);
} else {
final InputStream[] streams = new InputStream[myOffsets.length];
for (int i = 0; i < myOffsets.length; ++i) {
final int offset = myOffsets[i];
final int length = myLengths[i];
streams[i] = new SliceInputStream(myFile.getInputStream(), offset, length != 0 ? length : Integer.MAX_VALUE);
}
stream = new MergedInputStream(streams);
}
if (ENCODING_NONE.equals(myEncoding)) {
return stream;
} else if (ENCODING_HEX.equals(myEncoding)) {
return new HexInputStream(stream);
} else if (ENCODING_BASE64.equals(myEncoding)) {
return new Base64InputStream(stream);
} else {
System.err.println("unsupported encoding: " + myEncoding);
return null;
}
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
@Override
public InputStream inputStream() {
try {
final InputStream stream;
if (myOffsets.length == 1) {
final int offset = myOffsets[0];
final int length = myLengths[0];
stream = new SliceInputStream(myFile.getInputStream(), offset, length != 0 ? length : Integer.MAX_VALUE);
} else {
final InputStream[] streams = new InputStream[myOffsets.length];
for (int i = 0; i < myOffsets.length; ++i) {
final int offset = myOffsets[i];
final int length = myLengths[i];
streams[i] = new SliceInputStream(myFile.getInputStream(), offset, length != 0 ? length : Integer.MAX_VALUE);
}
stream = new MergedInputStream(streams);
}
if (ENCODING_NONE.equals(myEncoding)) {
return stream;
} else if (ENCODING_HEX.equals(myEncoding)) {
return new HexInputStream(stream);
} else if (ENCODING_BASE64.equals(myEncoding)) {
return new Base64InputStream(stream);
} else {
System.err.println("unsupported encoding: " + myEncoding);
return null;
}
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
}

View file

@ -32,7 +32,7 @@ public abstract class ZLImageManager {
public abstract ZLImageData getImageData(ZLImage image);
protected abstract void startImageLoading(ZLLoadableImage image, Runnable postLoadingRunnable);
protected final static class PalmImageHeader {
public final int Width;
public final int Height;
@ -40,7 +40,7 @@ public abstract class ZLImageManager {
public final int Flags;
public final byte BitsPerPixel;
public final byte CompressionType;
public PalmImageHeader(byte [] byteData) {
Width = uShort(byteData, 0);
Height = uShort(byteData, 2);
@ -50,12 +50,12 @@ public abstract class ZLImageManager {
CompressionType = (byte) (((Flags & 0x8000) != 0) ? byteData[13] : 0xFF);
}
}
protected static int PalmImage8bitColormap[][] = {
{255, 255, 255 }, { 255, 204, 255 }, { 255, 153, 255 }, { 255, 102, 255 },
{ 255, 51, 255 }, { 255, 0, 255 }, { 255, 255, 204 }, { 255, 204, 204 },
{ 255, 153, 204 }, { 255, 102, 204 }, { 255, 51, 204 }, { 255, 0, 204 },
{ 255, 255, 153 }, { 255, 204, 153 }, { 255, 153, 153 }, { 255, 102, 153 },
{255, 255, 255 }, { 255, 204, 255 }, { 255, 153, 255 }, { 255, 102, 255 },
{ 255, 51, 255 }, { 255, 0, 255 }, { 255, 255, 204 }, { 255, 204, 204 },
{ 255, 153, 204 }, { 255, 102, 204 }, { 255, 51, 204 }, { 255, 0, 204 },
{ 255, 255, 153 }, { 255, 204, 153 }, { 255, 153, 153 }, { 255, 102, 153 },
{ 255, 51, 153 }, { 255, 0, 153 }, { 204, 255, 255 }, { 204, 204, 255 },
{ 204, 153, 255 }, { 204, 102, 255 }, { 204, 51, 255 }, { 204, 0, 255 },
{ 204, 255, 204 }, { 204, 204, 204 }, { 204, 153, 204 }, { 204, 102, 204 },
@ -117,8 +117,8 @@ public abstract class ZLImageManager {
{ 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 },
{ 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }
};
private static int uShort(byte [] byteData, int offset) {
return ((byteData[offset] & 0xFF) << 8) + (byteData[offset + 1] & 0xFF);
}
}
}

View file

@ -32,7 +32,7 @@ public abstract class ZLLanguageUtil {
private ZLLanguageUtil() {
}
public static class CodeComparator implements Comparator<String> {
public int compare(String code0, String code1) {
if (code0 == null) {
@ -85,7 +85,7 @@ public abstract class ZLLanguageUtil {
return Collections.unmodifiableList(ourLanguageCodes);
}
public static String languageName(String code) {
return ZLResource.resource("language").getResource(code).getValue();
}

View file

@ -28,7 +28,7 @@ public abstract class ZLibrary {
public static ZLibrary Instance() {
return ourImplementation;
}
private static ZLibrary ourImplementation;
public static final String SCREEN_ORIENTATION_SYSTEM = "system";

View file

@ -67,7 +67,7 @@ public abstract class ZLNetworkRequest {
public void doBefore() throws ZLNetworkException {
}
public abstract void handleStream(InputStream inputStream, int length) throws IOException, ZLNetworkException;
public void doAfter(boolean success) throws ZLNetworkException {

View file

@ -23,7 +23,7 @@ import org.geometerplus.zlibrary.core.config.ZLConfig;
public abstract class ZLOption {
public static final String PLATFORM_GROUP = "PlatformOptions";
private final String myGroup;
private final String myOptionName;
protected boolean myIsSynchronized;

View file

@ -21,7 +21,7 @@ package org.geometerplus.zlibrary.core.resources;
abstract public class ZLResource {
public final String Name;
public static ZLResource resource(String key) {
ZLTreeResource.buildTree();
if (ZLTreeResource.ourRoot == null) {

View file

@ -31,11 +31,11 @@ public class Base64InputStream extends InputStream {
private final byte[] myBuffer = new byte[32768];
private int myBufferOffset;
private int myBufferLength;
public Base64InputStream(InputStream stream) {
myBaseStream = stream;
}
@Override
public int available() throws IOException {
// TODO: real value might be less than returned one

View file

@ -28,11 +28,11 @@ public class HexInputStream extends InputStream {
private final byte[] myBuffer = new byte[32768];
private int myBufferOffset;
private int myBufferLength;
public HexInputStream(InputStream stream) {
myBaseStream = stream;
}
@Override
public int available() throws IOException {
// TODO: real value might be less than returned one

View file

@ -25,14 +25,14 @@ import java.io.InputStream;
public class SliceInputStream extends ZLInputStreamWithOffset {
private final int myStart;
private final int myLength;
public SliceInputStream(InputStream base, int start, int length) throws IOException {
super(base);
super.skip(start);
myStart = start;
myLength = length;
}
@Override
public int read() throws IOException {
if (myLength >= offset()) {

View file

@ -23,7 +23,7 @@ public enum ZLBoolean3 {
B3_FALSE("false"),
B3_TRUE("true"),
B3_UNDEFINED("undefined");
public final String Name;
private ZLBoolean3(String name) {

View file

@ -27,25 +27,25 @@ public final class ZLColor {
public final short Red;
public final short Green;
public final short Blue;
public ZLColor(int r, int g, int b) {
Red = (short)(r & 0xFF);
Green = (short)(g & 0xFF);
Blue = (short)(b & 0xFF);
}
public ZLColor(int intValue) {
Red = (short)((intValue >> 16) & 0xFF);
Green = (short)((intValue >> 8) & 0xFF);
Blue = (short)(intValue & 0xFF);
}
public int getIntValue() {
return (Red << 16) + (Green << 8) + Blue;
}
public boolean equals(Object o) {
if (o == this) {
if (o == this) {
return true;
}

View file

@ -25,11 +25,11 @@ import java.io.InputStream;
public class ZLInputStreamWithOffset extends InputStream {
private final InputStream myDecoratedStream;
private int myOffset = 0;
public ZLInputStreamWithOffset(InputStream stream) {
myDecoratedStream = stream;
}
@Override
public int available() throws IOException {
return myDecoratedStream.available();

View file

@ -71,5 +71,5 @@ public abstract class ZLSearchUtil {
}
}
return -1;
}
}
}

View file

@ -62,7 +62,7 @@ public class ZLTTFInfoDetector {
final byte[] subtable = new byte[12];
myPosition += myStream.read(subtable);
final int numTables = getInt16(subtable, 4);
final byte[] tables = new byte[16 * numTables];
myPosition += myStream.read(tables);
@ -157,7 +157,7 @@ public class ZLTTFInfoDetector {
buffer = readTable(nameInfo);
} catch (Throwable e) {
return null;
}
}
if (getInt16(buffer, 0) != 0) {
throw new IOException("Name table format is invalid");
}

View file

@ -69,7 +69,7 @@ final class DummyPaintContext extends ZLPaintContext {
public int getHeight() {
return 1;
}
@Override
public int getStringWidth(char[] string, int offset, int length) {
return 1;

View file

@ -94,7 +94,7 @@ abstract public class ZLPaintContext {
abstract public int getWidth();
abstract public int getHeight();
public final int getStringWidth(String string) {
return getStringWidth(string.toCharArray(), 0, string.length());
}

View file

@ -185,7 +185,7 @@ final class ZLXMLParser {
return value;
}
private static HashMap<List<String>,HashMap<String,char[]>> ourDTDMaps =
private static HashMap<List<String>,HashMap<String,char[]>> ourDTDMaps =
new HashMap<List<String>,HashMap<String,char[]>>();
static synchronized HashMap<String,char[]> getDTDMap(List<String> dtdList) throws IOException {

View file

@ -35,7 +35,7 @@ public abstract class ZLXMLReaderAdapter implements ZLXMLReader {
return false;
}
}
public boolean readQuietly(String string) {
try {
read(string);
@ -44,11 +44,11 @@ public abstract class ZLXMLReaderAdapter implements ZLXMLReader {
return false;
}
}
public void read(ZLFile file) throws IOException {
ZLXMLProcessor.read(this, file);
}
public void read(InputStream stream) throws IOException {
ZLXMLProcessor.read(this, stream, 65536);
}
@ -68,21 +68,21 @@ public abstract class ZLXMLReaderAdapter implements ZLXMLReader {
public boolean startElementHandler(String tag, ZLStringMap attributes) {
return false;
}
public boolean endElementHandler(String tag) {
return false;
}
public void characterDataHandler(char[] ch, int start, int length) {
}
public void characterDataHandlerFinal(char[] ch, int start, int length) {
characterDataHandler(ch, start, length);
characterDataHandler(ch, start, length);
}
public void startDocumentHandler() {
}
public void endDocumentHandler() {
}

View file

@ -22,11 +22,11 @@ package org.geometerplus.zlibrary.text.hyphenation;
import java.util.List;
import org.geometerplus.zlibrary.core.util.*;
import org.geometerplus.zlibrary.text.view.ZLTextWord;
import org.geometerplus.zlibrary.text.view.ZLTextWord;
public abstract class ZLTextHyphenator {
private static ZLTextHyphenator ourInstance;
public static ZLTextHyphenator Instance() {
if (ourInstance == null) {
ourInstance = new ZLTextTeXHyphenator();
@ -78,16 +78,16 @@ public abstract class ZLTextHyphenator {
break;
case '-':
mask[i] = (i >= 3)
&& isLetter[i - 3]
&& isLetter[i - 2]
&& isLetter[i]
&& isLetter[i - 3]
&& isLetter[i - 2]
&& isLetter[i]
&& isLetter[i + 1];
break;
default:
mask[i] = mask[i]
&& isLetter[i - 2]
&& isLetter[i - 1]
&& isLetter[i]
mask[i] = mask[i]
&& isLetter[i - 2]
&& isLetter[i - 1]
&& isLetter[i]
&& isLetter[i + 1];
break;
}

View file

@ -100,7 +100,7 @@ final class ZLTextTeXHyphenator extends ZLTextHyphenator {
}
}
}
for (int i = 0; i < length - 1; i++) {
mask[i] = (values[i + 1] % 2) == 1;
}

View file

@ -35,7 +35,7 @@ public final class ZLImageEntry {
VOffset = vOffset;
IsCover = isCover;
}
public ZLImage getImage() {
return myImageMap.get(Id);
}

View file

@ -39,6 +39,6 @@ public interface ZLTextModel {
// text length for paragraphs from 0 to index
int getTextLength(int index);
int findParagraphByTextLength(int length);
int search(final String text, int startIndex, int endIndex, boolean ignoreCase);
}

View file

@ -22,7 +22,7 @@ package org.geometerplus.zlibrary.text.model;
class ZLTextParagraphImpl implements ZLTextParagraph {
private final ZLTextPlainModel myModel;
private final int myIndex;
ZLTextParagraphImpl(ZLTextPlainModel model, int index) {
myModel = model;
myIndex = index;

View file

@ -126,7 +126,7 @@ public abstract class ZLTextStyleEntry {
myFeatureMask |= 1 << Feature.ALIGNMENT_TYPE;
myAlignmentType = alignmentType;
}
public final byte getAlignmentType() {
return myAlignmentType;
}

View file

@ -38,7 +38,7 @@ public final class ZLTextRegion {
final boolean accepts(ZLTextElementArea area) {
return compareTo(area) == 0;
}
@Override
public final boolean equals(Object other) {
if (other == this) {

View file

@ -293,7 +293,7 @@ public abstract class ZLTextView extends ZLTextViewBase {
return mySelection.getCursorInMovementPoint();
}
if (cursor == ZLTextSelectionCursor.Left) {
if (cursor == ZLTextSelectionCursor.Left) {
if (mySelection.hasAPartBeforePage(page)) {
return null;
}

View file

@ -172,8 +172,8 @@ abstract class ZLTextViewBase extends ZLView {
}
protected final ZLPaintContext.ScalingType getScalingType(ZLTextImageElement imageElement) {
switch (getImageFitting()) {
default:
switch (getImageFitting()) {
default:
case none:
return ZLPaintContext.ScalingType.IntegerCoefficient;
case covers:

View file

@ -21,7 +21,7 @@ package org.geometerplus.zlibrary.text.view;
import org.geometerplus.zlibrary.core.view.ZLPaintContext;
public final class ZLTextWord extends ZLTextElement {
public final class ZLTextWord extends ZLTextElement {
public final char[] Data;
public final int Offset;
public final int Length;
@ -48,7 +48,7 @@ public final class ZLTextWord extends ZLTextElement {
myNext = mark;
}
}
public ZLTextWord(char[] data, int offset, int length, int paragraphOffset) {
Data = data;
Offset = offset;
@ -72,7 +72,7 @@ public final class ZLTextWord extends ZLTextElement {
public int getParagraphOffset() {
return myParagraphOffset;
}
public void addMark(int start, int length) {
Mark existingMark = myMark;
Mark mark = new Mark(start, length);
@ -85,13 +85,13 @@ public final class ZLTextWord extends ZLTextElement {
}
mark.setNext(existingMark.getNext());
existingMark.setNext(mark);
}
}
}
public int getWidth(ZLPaintContext context) {
int width = myWidth;
if (width <= 1) {
width = context.getStringWidth(Data, Offset, Length);
width = context.getStringWidth(Data, Offset, Length);
myWidth = width;
}
return width;

View file

@ -26,7 +26,7 @@ public final class ZLTextWordCursor extends ZLTextPosition {
private ZLTextParagraphCursor myParagraphCursor;
private int myElementIndex;
private int myCharIndex;
// private int myModelIndex;
public ZLTextWordCursor() {
@ -112,7 +112,7 @@ public final class ZLTextWordCursor extends ZLTextPosition {
}
return new ZLTextMark(paragraph.Index + 1, 0, 0);
}
public void nextWord() {
myElementIndex++;
myCharIndex = 0;
@ -165,7 +165,7 @@ public final class ZLTextWordCursor extends ZLTextPosition {
paragraphIndex = Math.max(0, Math.min(paragraphIndex, model.getParagraphsNumber() - 1));
myParagraphCursor = ZLTextParagraphCursor.cursor(model, paragraphIndex);
moveToParagraphStart();
}
}
}
public void moveTo(int wordIndex, int charIndex) {
@ -198,7 +198,7 @@ public final class ZLTextWordCursor extends ZLTextPosition {
}
}
}
}
}
public void reset() {
myParagraphCursor = null;

View file

@ -56,7 +56,7 @@ public class ZLTextBaseStyle extends ZLTextStyle {
fontSize = fontSize * ZLibrary.Instance().getDisplayDPI() / 320 * 2;
FontSizeOption = new ZLIntegerRangeOption(GROUP, "Base:fontSize", 5, Math.max(72, fontSize * 2), fontSize);
}
@Override
public String getFontFamily() {
return FontFamilyOption.getValue();
@ -105,7 +105,7 @@ public class ZLTextBaseStyle extends ZLTextStyle {
public int getFirstLineIndentDelta() {
return 0;
}
@Override
public int getLineSpacePercent() {
return LineSpaceOption.getValue() * 10;

View file

@ -25,10 +25,10 @@ import org.geometerplus.zlibrary.text.model.ZLTextAlignmentType;
public class ZLTextFullyDecoratedStyle extends ZLTextPartiallyDecoratedStyle {
private final ZLTextFullStyleDecoration myFullDecoration;
ZLTextFullyDecoratedStyle(ZLTextStyle base, ZLTextFullStyleDecoration decoration, ZLTextHyperlink hyperlink) {
super(base, decoration, hyperlink);
myFullDecoration = decoration;
myFullDecoration = decoration;
}
@Override
@ -45,7 +45,7 @@ public class ZLTextFullyDecoratedStyle extends ZLTextPartiallyDecoratedStyle {
public int getFirstLineIndentDelta() {
return (getAlignment() == ZLTextAlignmentType.ALIGN_CENTER) ? 0 : Base.getFirstLineIndentDelta() + myFullDecoration.FirstLineIndentDeltaOption.getValue();
}
@Override
public int getLineSpacePercent() {
int value = myFullDecoration.LineSpacePercentOption.getValue();
@ -60,7 +60,7 @@ public class ZLTextFullyDecoratedStyle extends ZLTextPartiallyDecoratedStyle {
@Override
public int getSpaceAfter() {
return myFullDecoration.SpaceAfterOption.getValue();
}
}
@Override
public byte getAlignment() {

View file

@ -29,7 +29,7 @@ class ZLTextPartiallyDecoratedStyle extends ZLTextDecoratedStyle {
ZLTextPartiallyDecoratedStyle(ZLTextStyle base, ZLTextStyleDecoration decoration, ZLTextHyperlink hyperlink) {
super(base, hyperlink);
myDecoration = decoration;
myDecoration = decoration;
}
@Override
@ -104,8 +104,8 @@ class ZLTextPartiallyDecoratedStyle extends ZLTextDecoratedStyle {
@Override
public int getFirstLineIndentDelta() {
return Base.getFirstLineIndentDelta();
}
}
@Override
public int getLineSpacePercent() {
return Base.getLineSpacePercent();
@ -124,7 +124,7 @@ class ZLTextPartiallyDecoratedStyle extends ZLTextDecoratedStyle {
@Override
public int getSpaceAfter() {
return Base.getSpaceAfter();
}
}
@Override
public byte getAlignment() {
@ -140,6 +140,6 @@ class ZLTextPartiallyDecoratedStyle extends ZLTextDecoratedStyle {
return true;
default:
return Base.allowHyphenations();
}
}
}
}

View file

@ -50,7 +50,7 @@ public class ZLTextStyleDecoration {
VerticalShiftOption = new ZLIntegerOption(STYLE, name + ":vShift", verticalShift);
AllowHyphenationsOption = new ZLBoolean3Option(STYLE, name + ":allowHyphenations", allowHyphenations);
}
public ZLTextStyle createDecoratedStyle(ZLTextStyle base) {
return createDecoratedStyle(base, null);
}
@ -58,7 +58,7 @@ public class ZLTextStyleDecoration {
public ZLTextStyle createDecoratedStyle(ZLTextStyle base, ZLTextHyperlink hyperlink) {
return new ZLTextPartiallyDecoratedStyle(base, this, hyperlink);
}
public String getName() {
return myName;
}

View file

@ -93,10 +93,10 @@ public final class ZLAndroidApplicationWindow extends ZLApplicationWindow {
}
}
}
@Override
public void runWithMessage(String key, Runnable action, Runnable postAction) {
final Activity activity =
final Activity activity =
((ZLAndroidLibrary)ZLAndroidLibrary.Instance()).getActivity();
if (activity != null) {
UIUtil.runWithMessage(activity, key, action, postAction, false);
@ -109,7 +109,7 @@ public final class ZLAndroidApplicationWindow extends ZLApplicationWindow {
protected void processException(Exception exception) {
exception.printStackTrace();
final Activity activity =
final Activity activity =
((ZLAndroidLibrary)ZLAndroidLibrary.Instance()).getActivity();
final Intent intent = new Intent(
"android.fbreader.action.ERROR",
@ -137,7 +137,7 @@ public final class ZLAndroidApplicationWindow extends ZLApplicationWindow {
@Override
public void setTitle(final String title) {
final Activity activity =
final Activity activity =
((ZLAndroidLibrary)ZLAndroidLibrary.Instance()).getActivity();
if (activity != null) {
activity.runOnUiThread(new Runnable() {

View file

@ -314,7 +314,7 @@ public final class ZLAndroidLibrary extends ZLibrary {
return length;
} catch (IOException e) {
return sizeSlow();
}
}
}
private long sizeSlow() {

View file

@ -111,7 +111,7 @@ public class SQLiteCookieDatabase extends CookieDatabase {
myInsertStatement.bindLong(6, c.isSecure() ? 1 : 0);
final long id = myInsertStatement.executeInsert();
myDeletePortsStatement.bindLong(1, id);
myDeletePortsStatement.execute();
myDeletePortsStatement.execute();
if (c.getPorts() != null) {
myInsertPortsStatement.bindLong(1, id);
for (int port : c.getPorts()) {

Some files were not shown because too many files have changed in this diff Show more