mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-04 18:29:23 +02:00
Merge branch 'master' into ice-cream-sandwich
Conflicts: src/org/geometerplus/android/fbreader/PopupWindow.java
This commit is contained in:
commit
38049e71a5
103 changed files with 503 additions and 502 deletions
|
@ -27,9 +27,9 @@ import android.widget.TextView;
|
||||||
* but it should only happen once per text change.
|
* but it should only happen once per text change.
|
||||||
* <p>
|
* <p>
|
||||||
* See http://code.google.com/p/android/issues/detail?id=35466
|
* See http://code.google.com/p/android/issues/detail?id=35466
|
||||||
*
|
*
|
||||||
* @author "Pierre-Yves Ricau" <py.ricau@gmail.com>
|
* @author "Pierre-Yves Ricau" <py.ricau@gmail.com>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class JellyBeanSpanFixTextView extends TextView {
|
public class JellyBeanSpanFixTextView extends TextView {
|
||||||
|
|
||||||
|
|
|
@ -4,47 +4,47 @@ import java.util.*;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
|
||||||
public abstract class Decompressor {
|
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
|
* 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(byte b[], int off, int len) throws IOException;
|
||||||
public abstract int read() 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) {
|
static void storeDecompressor(Decompressor decompressor) {
|
||||||
if (decompressor instanceof DeflatingDecompressor) {
|
if (decompressor instanceof DeflatingDecompressor) {
|
||||||
synchronized (ourDeflators) {
|
synchronized (ourDeflators) {
|
||||||
ourDeflators.add((DeflatingDecompressor)decompressor);
|
ourDeflators.add((DeflatingDecompressor)decompressor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Decompressor init(MyBufferedInputStream is, LocalFileHeader header) throws IOException {
|
static Decompressor init(MyBufferedInputStream is, LocalFileHeader header) throws IOException {
|
||||||
switch (header.CompressionMethod) {
|
switch (header.CompressionMethod) {
|
||||||
case 0:
|
case 0:
|
||||||
return new NoCompressionDecompressor(is, header);
|
return new NoCompressionDecompressor(is, header);
|
||||||
case 8:
|
case 8:
|
||||||
synchronized (ourDeflators) {
|
synchronized (ourDeflators) {
|
||||||
if (!ourDeflators.isEmpty()) {
|
if (!ourDeflators.isEmpty()) {
|
||||||
DeflatingDecompressor decompressor = ourDeflators.poll();
|
DeflatingDecompressor decompressor = ourDeflators.poll();
|
||||||
decompressor.reset(is, header);
|
decompressor.reset(is, header);
|
||||||
return decompressor;
|
return decompressor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new DeflatingDecompressor(is, header);
|
return new DeflatingDecompressor(is, header);
|
||||||
default:
|
default:
|
||||||
throw new ZipException("Unsupported method of compression");
|
throw new ZipException("Unsupported method of compression");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int available() throws IOException {
|
public int available() throws IOException {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,31 +8,31 @@ package org.amse.ys.zip;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class LocalFileHeader {
|
public class LocalFileHeader {
|
||||||
static final int FILE_HEADER_SIGNATURE = 0x04034b50;
|
static final int FILE_HEADER_SIGNATURE = 0x04034b50;
|
||||||
static final int FOLDER_HEADER_SIGNATURE = 0x02014b50;
|
static final int FOLDER_HEADER_SIGNATURE = 0x02014b50;
|
||||||
static final int END_OF_CENTRAL_DIRECTORY_SIGNATURE = 0x06054b50;
|
static final int END_OF_CENTRAL_DIRECTORY_SIGNATURE = 0x06054b50;
|
||||||
static final int DATA_DESCRIPTOR_SIGNATURE = 0x08074b50;
|
static final int DATA_DESCRIPTOR_SIGNATURE = 0x08074b50;
|
||||||
|
|
||||||
int Signature;
|
int Signature;
|
||||||
|
|
||||||
int Version;
|
int Version;
|
||||||
int Flags;
|
int Flags;
|
||||||
int CompressionMethod;
|
int CompressionMethod;
|
||||||
int ModificationTime;
|
int ModificationTime;
|
||||||
int ModificationDate;
|
int ModificationDate;
|
||||||
int CRC32;
|
int CRC32;
|
||||||
int CompressedSize;
|
int CompressedSize;
|
||||||
int UncompressedSize;
|
int UncompressedSize;
|
||||||
int NameLength;
|
int NameLength;
|
||||||
int ExtraLength;
|
int ExtraLength;
|
||||||
|
|
||||||
public String FileName;
|
public String FileName;
|
||||||
int DataOffset;
|
int DataOffset;
|
||||||
|
|
||||||
LocalFileHeader() {
|
LocalFileHeader() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void readFrom(MyBufferedInputStream stream) throws IOException {
|
void readFrom(MyBufferedInputStream stream) throws IOException {
|
||||||
Signature = stream.read4Bytes();
|
Signature = stream.read4Bytes();
|
||||||
switch (Signature) {
|
switch (Signature) {
|
||||||
default:
|
default:
|
||||||
|
@ -40,26 +40,26 @@ public class LocalFileHeader {
|
||||||
case END_OF_CENTRAL_DIRECTORY_SIGNATURE:
|
case END_OF_CENTRAL_DIRECTORY_SIGNATURE:
|
||||||
{
|
{
|
||||||
stream.skip(16);
|
stream.skip(16);
|
||||||
int comment = stream.read2Bytes();
|
int comment = stream.read2Bytes();
|
||||||
stream.skip(comment);
|
stream.skip(comment);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case FOLDER_HEADER_SIGNATURE:
|
case FOLDER_HEADER_SIGNATURE:
|
||||||
{
|
{
|
||||||
Version = stream.read4Bytes();
|
Version = stream.read4Bytes();
|
||||||
Flags = stream.read2Bytes();
|
Flags = stream.read2Bytes();
|
||||||
CompressionMethod = stream.read2Bytes();
|
CompressionMethod = stream.read2Bytes();
|
||||||
ModificationTime = stream.read2Bytes();
|
ModificationTime = stream.read2Bytes();
|
||||||
ModificationDate = stream.read2Bytes();
|
ModificationDate = stream.read2Bytes();
|
||||||
CRC32 = stream.read4Bytes();
|
CRC32 = stream.read4Bytes();
|
||||||
CompressedSize = stream.read4Bytes();
|
CompressedSize = stream.read4Bytes();
|
||||||
UncompressedSize = stream.read4Bytes();
|
UncompressedSize = stream.read4Bytes();
|
||||||
if (CompressionMethod == 0 && CompressedSize != UncompressedSize) {
|
if (CompressionMethod == 0 && CompressedSize != UncompressedSize) {
|
||||||
CompressedSize = UncompressedSize;
|
CompressedSize = UncompressedSize;
|
||||||
}
|
}
|
||||||
NameLength = stream.read2Bytes();
|
NameLength = stream.read2Bytes();
|
||||||
ExtraLength = stream.read2Bytes();
|
ExtraLength = stream.read2Bytes();
|
||||||
int comment = stream.read2Bytes();
|
int comment = stream.read2Bytes();
|
||||||
stream.skip(12);
|
stream.skip(12);
|
||||||
FileName = stream.readString(NameLength);
|
FileName = stream.readString(NameLength);
|
||||||
stream.skip(ExtraLength);
|
stream.skip(ExtraLength);
|
||||||
|
@ -67,19 +67,19 @@ public class LocalFileHeader {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case FILE_HEADER_SIGNATURE:
|
case FILE_HEADER_SIGNATURE:
|
||||||
Version = stream.read2Bytes();
|
Version = stream.read2Bytes();
|
||||||
Flags = stream.read2Bytes();
|
Flags = stream.read2Bytes();
|
||||||
CompressionMethod = stream.read2Bytes();
|
CompressionMethod = stream.read2Bytes();
|
||||||
ModificationTime = stream.read2Bytes();
|
ModificationTime = stream.read2Bytes();
|
||||||
ModificationDate = stream.read2Bytes();
|
ModificationDate = stream.read2Bytes();
|
||||||
CRC32 = stream.read4Bytes();
|
CRC32 = stream.read4Bytes();
|
||||||
CompressedSize = stream.read4Bytes();
|
CompressedSize = stream.read4Bytes();
|
||||||
UncompressedSize = stream.read4Bytes();
|
UncompressedSize = stream.read4Bytes();
|
||||||
if (CompressionMethod == 0 && CompressedSize != UncompressedSize) {
|
if (CompressionMethod == 0 && CompressedSize != UncompressedSize) {
|
||||||
CompressedSize = UncompressedSize;
|
CompressedSize = UncompressedSize;
|
||||||
}
|
}
|
||||||
NameLength = stream.read2Bytes();
|
NameLength = stream.read2Bytes();
|
||||||
ExtraLength = stream.read2Bytes();
|
ExtraLength = stream.read2Bytes();
|
||||||
FileName = stream.readString(NameLength);
|
FileName = stream.readString(NameLength);
|
||||||
stream.skip(ExtraLength);
|
stream.skip(ExtraLength);
|
||||||
break;
|
break;
|
||||||
|
@ -90,5 +90,5 @@ public class LocalFileHeader {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
DataOffset = stream.offset();
|
DataOffset = stream.offset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,40 +3,40 @@ package org.amse.ys.zip;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
|
||||||
public class NoCompressionDecompressor extends Decompressor {
|
public class NoCompressionDecompressor extends Decompressor {
|
||||||
private final LocalFileHeader myHeader;
|
private final LocalFileHeader myHeader;
|
||||||
private final MyBufferedInputStream myStream;
|
private final MyBufferedInputStream myStream;
|
||||||
private int myCurrentPosition;
|
private int myCurrentPosition;
|
||||||
|
|
||||||
public NoCompressionDecompressor(MyBufferedInputStream is, LocalFileHeader header) {
|
public NoCompressionDecompressor(MyBufferedInputStream is, LocalFileHeader header) {
|
||||||
super();
|
super();
|
||||||
myHeader = header;
|
myHeader = header;
|
||||||
myStream = is;
|
myStream = is;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int read(byte b[], int off, int len) throws IOException {
|
public int read(byte b[], int off, int len) throws IOException {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (; i < len; ++i) {
|
for (; i < len; ++i) {
|
||||||
int value = read();
|
int value = read();
|
||||||
if (value == -1) {
|
if (value == -1) {
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
if (b != null) {
|
|
||||||
b[off + i] = (byte)value;
|
|
||||||
}
|
}
|
||||||
}
|
if (b != null) {
|
||||||
return (i > 0) ? i : -1;
|
b[off + i] = (byte)value;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
return (i > 0) ? i : -1;
|
||||||
|
}
|
||||||
|
|
||||||
public int read() throws IOException {
|
public int read() throws IOException {
|
||||||
if (myCurrentPosition < myHeader.CompressedSize) {
|
if (myCurrentPosition < myHeader.CompressedSize) {
|
||||||
myCurrentPosition++;
|
myCurrentPosition++;
|
||||||
return myStream.read();
|
return myStream.read();
|
||||||
} else {
|
} else {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int available() throws IOException {
|
public int available() throws IOException {
|
||||||
return (myHeader.UncompressedSize - myCurrentPosition);
|
return (myHeader.UncompressedSize - myCurrentPosition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import java.io.IOException;
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class ZipException extends IOException {
|
public class ZipException extends IOException {
|
||||||
ZipException(String message) {
|
ZipException(String message) {
|
||||||
super(message);
|
super(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,48 +4,48 @@ import java.io.*;
|
||||||
|
|
||||||
class ZipInputStream extends InputStream {
|
class ZipInputStream extends InputStream {
|
||||||
private final ZipFile myParent;
|
private final ZipFile myParent;
|
||||||
private final MyBufferedInputStream myBaseStream;
|
private final MyBufferedInputStream myBaseStream;
|
||||||
private final Decompressor myDecompressor;
|
private final Decompressor myDecompressor;
|
||||||
private boolean myIsClosed;
|
private boolean myIsClosed;
|
||||||
|
|
||||||
public ZipInputStream(ZipFile parent, LocalFileHeader header) throws IOException {
|
public ZipInputStream(ZipFile parent, LocalFileHeader header) throws IOException {
|
||||||
myParent = parent;
|
myParent = parent;
|
||||||
myBaseStream = parent.getBaseStream();
|
myBaseStream = parent.getBaseStream();
|
||||||
myBaseStream.setPosition(header.DataOffset);
|
myBaseStream.setPosition(header.DataOffset);
|
||||||
myDecompressor = Decompressor.init(myBaseStream, header);
|
myDecompressor = Decompressor.init(myBaseStream, header);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int available() throws IOException {
|
public int available() throws IOException {
|
||||||
return myDecompressor.available();
|
return myDecompressor.available();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int read(byte b[], int off, int len) throws IOException {
|
public int read(byte b[], int off, int len) throws IOException {
|
||||||
if (b == null) {
|
if (b == null) {
|
||||||
throw new NullPointerException();
|
throw new NullPointerException();
|
||||||
} else if ((off < 0) || (off > b.length) || (len < 0) ||
|
} else if ((off < 0) || (off > b.length) || (len < 0) ||
|
||||||
((off + len) > b.length) || ((off + len) < 0)) {
|
((off + len) > b.length) || ((off + len) < 0)) {
|
||||||
throw new IndexOutOfBoundsException();
|
throw new IndexOutOfBoundsException();
|
||||||
} else if (len == 0) {
|
} else if (len == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return myDecompressor.read(b, off, len);
|
return myDecompressor.read(b, off, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int read() throws IOException {
|
public int read() throws IOException {
|
||||||
return myDecompressor.read();
|
return myDecompressor.read();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void close() throws IOException {
|
public void close() throws IOException {
|
||||||
if (!myIsClosed) {
|
if (!myIsClosed) {
|
||||||
myIsClosed = true;
|
myIsClosed = true;
|
||||||
myParent.storeBaseStream(myBaseStream);
|
myParent.storeBaseStream(myBaseStream);
|
||||||
Decompressor.storeDecompressor(myDecompressor);
|
Decompressor.storeDecompressor(myDecompressor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void finalize() throws Throwable {
|
protected void finalize() throws Throwable {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -90,7 +90,7 @@ public abstract class DictionaryUtil {
|
||||||
ParagonInfoReader(Context context) {
|
ParagonInfoReader(Context context) {
|
||||||
myContext = context;
|
myContext = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean dontCacheAttributeValues() {
|
public boolean dontCacheAttributeValues() {
|
||||||
return true;
|
return true;
|
||||||
|
@ -238,7 +238,7 @@ public abstract class DictionaryUtil {
|
||||||
return intent.putExtra(dictionaryInfo.IntentKey, text);
|
return intent.putExtra(dictionaryInfo.IntentKey, text);
|
||||||
} else {
|
} else {
|
||||||
return intent.setData(Uri.parse(text));
|
return intent.setData(Uri.parse(text));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void openTextInDictionary(Activity activity, String text, boolean singleWord, int selectionTop, int selectionBottom) {
|
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(
|
openTextInDictionary(
|
||||||
activity, word.toString(), true, region.getTop(), region.getBottom()
|
activity, word.toString(), true, region.getTop(), region.getBottom()
|
||||||
);
|
);
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class PopupWindow extends LinearLayout {
|
||||||
myActivity = activity;
|
myActivity = activity;
|
||||||
|
|
||||||
setFocusable(false);
|
setFocusable(false);
|
||||||
|
|
||||||
final LayoutInflater inflater =
|
final LayoutInflater inflater =
|
||||||
(LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
(LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
final RelativeLayout.LayoutParams p;
|
final RelativeLayout.LayoutParams p;
|
||||||
|
@ -139,6 +139,7 @@ public class PopupWindow extends LinearLayout {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void hideInternal() {
|
private void hideInternal() {
|
||||||
if (myAnimated) {
|
if (myAnimated) {
|
||||||
if (myShowHideAnimator != null) {
|
if (myShowHideAnimator != null) {
|
||||||
|
@ -157,7 +158,7 @@ public class PopupWindow extends LinearLayout {
|
||||||
setVisibility(View.GONE);
|
setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addView(View view) {
|
public void addView(View view) {
|
||||||
((LinearLayout)findViewById(R.id.tools_plate)).addView(view);
|
((LinearLayout)findViewById(R.id.tools_plate)).addView(view);
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ public class SelectionShareAction extends FBAndroidAction {
|
||||||
|
|
||||||
final Intent intent = new Intent(android.content.Intent.ACTION_SEND);
|
final Intent intent = new Intent(android.content.Intent.ACTION_SEND);
|
||||||
intent.setType("text/plain");
|
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)
|
ZLResource.resource("selection").getResource("quoteFrom").getValue().replace("%s", title)
|
||||||
);
|
);
|
||||||
intent.putExtra(android.content.Intent.EXTRA_TEXT, text);
|
intent.putExtra(android.content.Intent.EXTRA_TEXT, text);
|
||||||
|
|
|
@ -63,7 +63,7 @@ public class TOCActivity extends ListActivity {
|
||||||
final TOCTree root = fbreader.Model.TOCTree;
|
final TOCTree root = fbreader.Model.TOCTree;
|
||||||
myAdapter = new TOCAdapter(root);
|
myAdapter = new TOCAdapter(root);
|
||||||
final ZLTextWordCursor cursor = fbreader.BookTextView.getStartCursor();
|
final ZLTextWordCursor cursor = fbreader.BookTextView.getStartCursor();
|
||||||
int index = cursor.getParagraphIndex();
|
int index = cursor.getParagraphIndex();
|
||||||
if (cursor.isEndOfParagraph()) {
|
if (cursor.isEndOfParagraph()) {
|
||||||
++index;
|
++index;
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,12 +117,12 @@ public class BookInfoActivity extends Activity implements MenuItem.OnMenuItemCli
|
||||||
public static Intent intentByBook(Book book) {
|
public static Intent intentByBook(Book book) {
|
||||||
return new Intent().putExtra(FBReader.BOOK_KEY, SerializerUtil.serialize(book));
|
return new Intent().putExtra(FBReader.BOOK_KEY, SerializerUtil.serialize(book));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Book bookByIntent(Intent intent) {
|
public static Book bookByIntent(Intent intent) {
|
||||||
return intent != null ?
|
return intent != null ?
|
||||||
SerializerUtil.deserializeBook(intent.getStringExtra(FBReader.BOOK_KEY)) : null;
|
SerializerUtil.deserializeBook(intent.getStringExtra(FBReader.BOOK_KEY)) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
final Book book = bookByIntent(data);
|
final Book book = bookByIntent(data);
|
||||||
|
|
|
@ -83,7 +83,7 @@ public class BookCollectionShadow extends AbstractBookCollection implements Serv
|
||||||
myContext.unregisterReceiver(myReceiver);
|
myContext.unregisterReceiver(myReceiver);
|
||||||
myContext.unbindService(this);
|
myContext.unbindService(this);
|
||||||
myInterface = null;
|
myInterface = null;
|
||||||
myContext = null;
|
myContext = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -271,7 +271,7 @@ public class AddCustomCatalogActivity extends Activity {
|
||||||
});
|
});
|
||||||
setErrorText(myError);
|
setErrorText(myError);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
UIUtil.wait("loadingCatalogInfo", loadInfoRunnable, this);
|
UIUtil.wait("loadingCatalogInfo", loadInfoRunnable, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ public class BookDownloader extends Activity {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!intent.hasExtra(BookDownloaderService.SHOW_NOTIFICATIONS_KEY)) {
|
if (!intent.hasExtra(BookDownloaderService.SHOW_NOTIFICATIONS_KEY)) {
|
||||||
intent.putExtra(BookDownloaderService.SHOW_NOTIFICATIONS_KEY,
|
intent.putExtra(BookDownloaderService.SHOW_NOTIFICATIONS_KEY,
|
||||||
BookDownloaderService.Notifications.ALREADY_DOWNLOADING);
|
BookDownloaderService.Notifications.ALREADY_DOWNLOADING);
|
||||||
}
|
}
|
||||||
if ("epub".equals(uri.getScheme())) {
|
if ("epub".equals(uri.getScheme())) {
|
||||||
|
|
|
@ -173,7 +173,7 @@ class SQLiteNetworkDatabase extends NetworkDatabase {
|
||||||
id = link.getId();
|
id = link.getId();
|
||||||
statement.bindLong(5, id);
|
statement.bindLong(5, id);
|
||||||
statement.execute();
|
statement.execute();
|
||||||
|
|
||||||
final Cursor linksCursor = myDatabase.rawQuery("SELECT key,url,mime,update_time FROM LinkUrls WHERE link_id = " + link.getId(), null);
|
final Cursor linksCursor = myDatabase.rawQuery("SELECT key,url,mime,update_time FROM LinkUrls WHERE link_id = " + link.getId(), null);
|
||||||
while (linksCursor.moveToNext()) {
|
while (linksCursor.moveToNext()) {
|
||||||
try {
|
try {
|
||||||
|
@ -273,7 +273,7 @@ class SQLiteNetworkDatabase extends NetworkDatabase {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createTables() {
|
private void createTables() {
|
||||||
myDatabase.execSQL(
|
myDatabase.execSQL(
|
||||||
"CREATE TABLE CustomLinks(" +
|
"CREATE TABLE CustomLinks(" +
|
||||||
|
|
|
@ -72,7 +72,7 @@ public abstract class NetworkBookActions {
|
||||||
@Override
|
@Override
|
||||||
public boolean isEnabled(NetworkTree tree) {
|
public boolean isEnabled(NetworkTree tree) {
|
||||||
return myId >= 0;
|
return myId >= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getContextLabel(NetworkTree tree) {
|
public String getContextLabel(NetworkTree tree) {
|
||||||
|
|
|
@ -92,23 +92,23 @@ class AnimationSpeedPreference extends DialogPreference {
|
||||||
protected void onBoundsChange(Rect bounds) {
|
protected void onBoundsChange(Rect bounds) {
|
||||||
myBase.setBounds(bounds);
|
myBase.setBounds(bounds);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean onStateChange(int[] state) {
|
protected boolean onStateChange(int[] state) {
|
||||||
invalidateSelf();
|
invalidateSelf();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isStateful() {
|
public boolean isStateful() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean onLevelChange(int level) {
|
protected boolean onLevelChange(int level) {
|
||||||
return myBase.setLevel(level);
|
return myBase.setLevel(level);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(Canvas canvas) {
|
public void draw(Canvas canvas) {
|
||||||
myBase.draw(canvas);
|
myBase.draw(canvas);
|
||||||
|
|
|
@ -35,7 +35,7 @@ class DictionaryPreference extends ZLStringListPreference {
|
||||||
super(context, resource, resourceKey);
|
super(context, resource, resourceKey);
|
||||||
|
|
||||||
myOption = dictionaryOption;
|
myOption = dictionaryOption;
|
||||||
|
|
||||||
final String[] values = new String[infos.size()];
|
final String[] values = new String[infos.size()];
|
||||||
final String[] texts = new String[infos.size()];
|
final String[] texts = new String[infos.size()];
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
|
|
@ -39,7 +39,7 @@ class WallpaperPreference extends ZLStringListPreference {
|
||||||
myOption = profile.WallpaperOption;
|
myOption = profile.WallpaperOption;
|
||||||
final List<ZLFile> predefined = WallpapersUtil.predefinedWallpaperFiles();
|
final List<ZLFile> predefined = WallpapersUtil.predefinedWallpaperFiles();
|
||||||
final List<ZLFile> external = WallpapersUtil.externalWallpaperFiles();
|
final List<ZLFile> external = WallpapersUtil.externalWallpaperFiles();
|
||||||
|
|
||||||
final int size = 1 + predefined.size() + external.size();
|
final int size = 1 + predefined.size() + external.size();
|
||||||
final String[] values = new String[size];
|
final String[] values = new String[size];
|
||||||
final String[] texts = new String[size];
|
final String[] texts = new String[size];
|
||||||
|
|
|
@ -126,7 +126,7 @@ class ZLColorPreference extends DialogPreference {
|
||||||
//colorView.setImageResource(R.drawable.fbreader);
|
//colorView.setImageResource(R.drawable.fbreader);
|
||||||
final Drawable drawable = new ColorDrawable(0x00FF00);
|
final Drawable drawable = new ColorDrawable(0x00FF00);
|
||||||
colorView.setImageDrawable(drawable);
|
colorView.setImageDrawable(drawable);
|
||||||
|
|
||||||
super.onBindView(view);
|
super.onBindView(view);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
@ -161,18 +161,18 @@ class ZLColorPreference extends DialogPreference {
|
||||||
protected void onBoundsChange(Rect bounds) {
|
protected void onBoundsChange(Rect bounds) {
|
||||||
myBase.setBounds(bounds);
|
myBase.setBounds(bounds);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean onStateChange(int[] state) {
|
protected boolean onStateChange(int[] state) {
|
||||||
invalidateSelf();
|
invalidateSelf();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isStateful() {
|
public boolean isStateful() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean onLevelChange(int level) {
|
protected boolean onLevelChange(int level) {
|
||||||
if (level < 4000) {
|
if (level < 4000) {
|
||||||
|
@ -182,7 +182,7 @@ class ZLColorPreference extends DialogPreference {
|
||||||
}
|
}
|
||||||
return myBase.setLevel(level);
|
return myBase.setLevel(level);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(Canvas canvas) {
|
public void draw(Canvas canvas) {
|
||||||
myBase.draw(canvas);
|
myBase.draw(canvas);
|
||||||
|
|
|
@ -93,7 +93,7 @@ public class TipsActivity extends Activity {
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
final Button nextTipButton =
|
final Button nextTipButton =
|
||||||
(Button)findViewById(R.id.tip_buttons).findViewById(R.id.cancel_button);
|
(Button)findViewById(R.id.tip_buttons).findViewById(R.id.cancel_button);
|
||||||
nextTipButton.setText(resource.getResource("more").getValue());
|
nextTipButton.setText(resource.getResource("more").getValue());
|
||||||
|
@ -103,7 +103,7 @@ public class TipsActivity extends Activity {
|
||||||
showTip(nextTipButton);
|
showTip(nextTipButton);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
showTip(nextTipButton);
|
showTip(nextTipButton);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ public abstract class UIUtil {
|
||||||
};
|
};
|
||||||
private static final Queue<Pair> ourTaskQueue = new LinkedList<Pair>();
|
private static final Queue<Pair> ourTaskQueue = new LinkedList<Pair>();
|
||||||
private static volatile Handler ourProgressHandler;
|
private static volatile Handler ourProgressHandler;
|
||||||
|
|
||||||
private static boolean init() {
|
private static boolean init() {
|
||||||
if (ourProgressHandler != null) {
|
if (ourProgressHandler != null) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -114,7 +114,7 @@ public abstract class UIUtil {
|
||||||
activity.runOnUiThread(new Runnable() {
|
activity.runOnUiThread(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
final ProgressDialog progress = ProgressDialog.show(activity, null, message, true, false);
|
final ProgressDialog progress = ProgressDialog.show(activity, null, message, true, false);
|
||||||
|
|
||||||
final Thread runner = new Thread() {
|
final Thread runner = new Thread() {
|
||||||
public void run() {
|
public void run() {
|
||||||
action.run();
|
action.run();
|
||||||
|
|
|
@ -27,7 +27,7 @@ public final class Author {
|
||||||
DisplayName = displayName;
|
DisplayName = displayName;
|
||||||
SortKey = sortKey;
|
SortKey = sortKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int hashCode(Author author) {
|
public static int hashCode(Author author) {
|
||||||
return author == null ? 0 : author.hashCode();
|
return author == null ? 0 : author.hashCode();
|
||||||
}
|
}
|
||||||
|
|
|
@ -382,7 +382,7 @@ public class BookCollection extends AbstractBookCollection {
|
||||||
);
|
);
|
||||||
file.setCached(false);
|
file.setCached(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Step 4: add help file
|
// Step 4: add help file
|
||||||
try {
|
try {
|
||||||
final ZLFile helpFile = getHelpFile();
|
final ZLFile helpFile = getHelpFile();
|
||||||
|
@ -437,7 +437,7 @@ public class BookCollection extends AbstractBookCollection {
|
||||||
fileList.add(entry);
|
fileList.add(entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return fileList;
|
return fileList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -168,7 +168,7 @@ public final class FileInfoSet {
|
||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
return info.Id;
|
return info.Id;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ZLFile getFile(FileInfo info) {
|
private ZLFile getFile(FileInfo info) {
|
||||||
if (info == null) {
|
if (info == null) {
|
||||||
|
|
|
@ -211,7 +211,7 @@ class XMLSerializer extends AbstractSerializer {
|
||||||
}
|
}
|
||||||
|
|
||||||
private State myState = State.READ_NOTHING;
|
private State myState = State.READ_NOTHING;
|
||||||
|
|
||||||
private long myId = -1;
|
private long myId = -1;
|
||||||
private String myUrl;
|
private String myUrl;
|
||||||
private final StringBuilder myTitle = new StringBuilder();
|
private final StringBuilder myTitle = new StringBuilder();
|
||||||
|
@ -318,7 +318,7 @@ class XMLSerializer extends AbstractSerializer {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean endElementHandler(String tag) {
|
public boolean endElementHandler(String tag) {
|
||||||
switch (myState) {
|
switch (myState) {
|
||||||
|
@ -327,7 +327,7 @@ class XMLSerializer extends AbstractSerializer {
|
||||||
case READ_ENTRY:
|
case READ_ENTRY:
|
||||||
if ("entry".equals(tag)) {
|
if ("entry".equals(tag)) {
|
||||||
myState = State.READ_NOTHING;
|
myState = State.READ_NOTHING;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case READ_AUTHOR_URI:
|
case READ_AUTHOR_URI:
|
||||||
case READ_AUTHOR_NAME:
|
case READ_AUTHOR_NAME:
|
||||||
|
@ -347,7 +347,7 @@ class XMLSerializer extends AbstractSerializer {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void characterDataHandler(char[] ch, int start, int length) {
|
public void characterDataHandler(char[] ch, int start, int length) {
|
||||||
switch (myState) {
|
switch (myState) {
|
||||||
|
@ -391,7 +391,7 @@ class XMLSerializer extends AbstractSerializer {
|
||||||
|
|
||||||
private State myState = State.READ_NOTHING;
|
private State myState = State.READ_NOTHING;
|
||||||
private Bookmark myBookmark;
|
private Bookmark myBookmark;
|
||||||
|
|
||||||
private long myId = -1;
|
private long myId = -1;
|
||||||
private long myBookId;
|
private long myBookId;
|
||||||
private String myBookTitle;
|
private String myBookTitle;
|
||||||
|
@ -496,7 +496,7 @@ class XMLSerializer extends AbstractSerializer {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean endElementHandler(String tag) {
|
public boolean endElementHandler(String tag) {
|
||||||
switch (myState) {
|
switch (myState) {
|
||||||
|
@ -505,14 +505,14 @@ class XMLSerializer extends AbstractSerializer {
|
||||||
case READ_BOOKMARK:
|
case READ_BOOKMARK:
|
||||||
if ("bookmark".equals(tag)) {
|
if ("bookmark".equals(tag)) {
|
||||||
myState = State.READ_NOTHING;
|
myState = State.READ_NOTHING;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case READ_TEXT:
|
case READ_TEXT:
|
||||||
myState = State.READ_BOOKMARK;
|
myState = State.READ_BOOKMARK;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void characterDataHandler(char[] ch, int start, int length) {
|
public void characterDataHandler(char[] ch, int start, int length) {
|
||||||
if (myState == State.READ_TEXT) {
|
if (myState == State.READ_TEXT) {
|
||||||
|
|
|
@ -46,11 +46,11 @@ public class TOCTree extends ZLTree<TOCTree> {
|
||||||
myText = null;
|
myText = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Reference getReference() {
|
public Reference getReference() {
|
||||||
return myReference;
|
return myReference;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setReference(ZLTextModel model, int reference) {
|
public void setReference(ZLTextModel model, int reference) {
|
||||||
myReference = new Reference(reference, model);
|
myReference = new Reference(reference, model);
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ public class TOCTree extends ZLTree<TOCTree> {
|
||||||
public static class Reference {
|
public static class Reference {
|
||||||
public final int ParagraphIndex;
|
public final int ParagraphIndex;
|
||||||
public final ZLTextModel Model;
|
public final ZLTextModel Model;
|
||||||
|
|
||||||
public Reference(final int paragraphIndex, final ZLTextModel model) {
|
public Reference(final int paragraphIndex, final ZLTextModel model) {
|
||||||
ParagraphIndex = paragraphIndex;
|
ParagraphIndex = paragraphIndex;
|
||||||
Model = model;
|
Model = model;
|
||||||
|
|
|
@ -35,29 +35,29 @@ public class TapZoneMap {
|
||||||
ourPredefinedMaps.add("left_to_right");
|
ourPredefinedMaps.add("left_to_right");
|
||||||
ourPredefinedMaps.add("down");
|
ourPredefinedMaps.add("down");
|
||||||
ourPredefinedMaps.add("up");
|
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>();
|
private static final Map<String,TapZoneMap> ourMaps = new HashMap<String,TapZoneMap>();
|
||||||
|
|
||||||
public static List<String> zoneMapNames() {
|
public static List<String> zoneMapNames() {
|
||||||
return ourMapsOption.getValue();
|
return ourMapsOption.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TapZoneMap zoneMap(String name) {
|
public static TapZoneMap zoneMap(String name) {
|
||||||
TapZoneMap map = ourMaps.get(name);
|
TapZoneMap map = ourMaps.get(name);
|
||||||
if (map == null) {
|
if (map == null) {
|
||||||
map = new TapZoneMap(name);
|
map = new TapZoneMap(name);
|
||||||
ourMaps.put(name, map);
|
ourMaps.put(name, map);
|
||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TapZoneMap createZoneMap(String name, int width, int height) {
|
public static TapZoneMap createZoneMap(String name, int width, int height) {
|
||||||
if (ourMapsOption.getValue().contains(name)) {
|
if (ourMapsOption.getValue().contains(name)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
final TapZoneMap map = zoneMap(name);
|
final TapZoneMap map = zoneMap(name);
|
||||||
map.myWidth.setValue(width);
|
map.myWidth.setValue(width);
|
||||||
map.myHeight.setValue(height);
|
map.myHeight.setValue(height);
|
||||||
final List<String> lst = new LinkedList<String>(ourMapsOption.getValue());
|
final List<String> lst = new LinkedList<String>(ourMapsOption.getValue());
|
||||||
|
@ -68,10 +68,10 @@ public class TapZoneMap {
|
||||||
|
|
||||||
public static void deleteZoneMap(String name) {
|
public static void deleteZoneMap(String name) {
|
||||||
if (ourPredefinedMaps.contains(name)) {
|
if (ourPredefinedMaps.contains(name)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ourMaps.remove(name);
|
ourMaps.remove(name);
|
||||||
|
|
||||||
final List<String> lst = new LinkedList<String>(ourMapsOption.getValue());
|
final List<String> lst = new LinkedList<String>(ourMapsOption.getValue());
|
||||||
lst.remove(name);
|
lst.remove(name);
|
||||||
|
@ -84,15 +84,15 @@ public class TapZoneMap {
|
||||||
doubleTap
|
doubleTap
|
||||||
};
|
};
|
||||||
|
|
||||||
public final String Name;
|
public final String Name;
|
||||||
private final String myOptionGroupName;
|
private final String myOptionGroupName;
|
||||||
private ZLIntegerRangeOption myHeight;
|
private ZLIntegerRangeOption myHeight;
|
||||||
private ZLIntegerRangeOption myWidth;
|
private ZLIntegerRangeOption myWidth;
|
||||||
private final HashMap<Zone,ZLStringOption> myZoneMap = new HashMap<Zone,ZLStringOption>();
|
private final HashMap<Zone,ZLStringOption> myZoneMap = new HashMap<Zone,ZLStringOption>();
|
||||||
private final HashMap<Zone,ZLStringOption> myZoneMap2 = new HashMap<Zone,ZLStringOption>();
|
private final HashMap<Zone,ZLStringOption> myZoneMap2 = new HashMap<Zone,ZLStringOption>();
|
||||||
|
|
||||||
private TapZoneMap(String name) {
|
private TapZoneMap(String name) {
|
||||||
Name = name;
|
Name = name;
|
||||||
myOptionGroupName = "TapZones:" + name;
|
myOptionGroupName = "TapZones:" + name;
|
||||||
myHeight = new ZLIntegerRangeOption(myOptionGroupName, "Height", 2, 5, 3);
|
myHeight = new ZLIntegerRangeOption(myOptionGroupName, "Height", 2, 5, 3);
|
||||||
myWidth = new ZLIntegerRangeOption(myOptionGroupName, "Width", 2, 5, 3);
|
myWidth = new ZLIntegerRangeOption(myOptionGroupName, "Width", 2, 5, 3);
|
||||||
|
@ -103,15 +103,15 @@ public class TapZoneMap {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCustom() {
|
public boolean isCustom() {
|
||||||
return !ourPredefinedMaps.contains(Name);
|
return !ourPredefinedMaps.contains(Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getHeight() {
|
public int getHeight() {
|
||||||
return myHeight.getValue();
|
return myHeight.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getWidth() {
|
public int getWidth() {
|
||||||
return myWidth.getValue();
|
return myWidth.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getActionByCoordinates(int x, int y, int width, int height, Tap tap) {
|
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;
|
return option != null ? option.getValue() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ZLStringOption getOptionByZone(Zone zone, Tap tap) {
|
private ZLStringOption getOptionByZone(Zone zone, Tap tap) {
|
||||||
switch (tap) {
|
switch (tap) {
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
case singleTap:
|
case singleTap:
|
||||||
{
|
{
|
||||||
final ZLStringOption option = myZoneMap.get(zone);
|
final ZLStringOption option = myZoneMap.get(zone);
|
||||||
return option != null ? option : myZoneMap2.get(zone);
|
return option != null ? option : myZoneMap2.get(zone);
|
||||||
}
|
}
|
||||||
case singleNotDoubleTap:
|
case singleNotDoubleTap:
|
||||||
return myZoneMap.get(zone);
|
return myZoneMap.get(zone);
|
||||||
case doubleTap:
|
case doubleTap:
|
||||||
return myZoneMap2.get(zone);
|
return myZoneMap2.get(zone);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private ZLStringOption createOptionForZone(Zone zone, boolean singleTap, String action) {
|
private ZLStringOption createOptionForZone(Zone zone, boolean singleTap, String action) {
|
||||||
return new ZLStringOption(
|
return new ZLStringOption(
|
||||||
myOptionGroupName,
|
myOptionGroupName,
|
||||||
(singleTap ? "Action" : "Action2") + ":" + zone.HIndex + ":" + zone.VIndex,
|
(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 Zone zone = new Zone(h, v);
|
||||||
final HashMap<Zone,ZLStringOption> map = singleTap ? myZoneMap : myZoneMap2;
|
final HashMap<Zone,ZLStringOption> map = singleTap ? myZoneMap : myZoneMap2;
|
||||||
ZLStringOption option = map.get(zone);
|
ZLStringOption option = map.get(zone);
|
||||||
if (option == null) {
|
if (option == null) {
|
||||||
option = createOptionForZone(zone, singleTap, null);
|
option = createOptionForZone(zone, singleTap, null);
|
||||||
map.put(zone, option);
|
map.put(zone, option);
|
||||||
}
|
}
|
||||||
option.setValue(action);
|
option.setValue(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class Zone {
|
private static class Zone {
|
||||||
int HIndex;
|
int HIndex;
|
||||||
|
@ -202,9 +202,9 @@ public class TapZoneMap {
|
||||||
try {
|
try {
|
||||||
if ("zone".equals(tag)) {
|
if ("zone".equals(tag)) {
|
||||||
final Zone zone = new Zone(
|
final Zone zone = new Zone(
|
||||||
Integer.parseInt(attributes.getValue("x")),
|
Integer.parseInt(attributes.getValue("x")),
|
||||||
Integer.parseInt(attributes.getValue("y"))
|
Integer.parseInt(attributes.getValue("y"))
|
||||||
);
|
);
|
||||||
final String action = attributes.getValue("action");
|
final String action = attributes.getValue("action");
|
||||||
final String action2 = attributes.getValue("action2");
|
final String action2 = attributes.getValue("action2");
|
||||||
if (action != null) {
|
if (action != null) {
|
||||||
|
|
|
@ -37,7 +37,7 @@ final class Base64EncodedImage extends ZLBase64EncodedImage {
|
||||||
private final int myFileNumber;
|
private final int myFileNumber;
|
||||||
private final String myNamePostfix;
|
private final String myNamePostfix;
|
||||||
private OutputStreamWriter myStreamWriter;
|
private OutputStreamWriter myStreamWriter;
|
||||||
|
|
||||||
public Base64EncodedImage(MimeType mimeType, String namePostfix) {
|
public Base64EncodedImage(MimeType mimeType, String namePostfix) {
|
||||||
// TODO: use contentType
|
// TODO: use contentType
|
||||||
super(mimeType);
|
super(mimeType);
|
||||||
|
|
|
@ -33,11 +33,11 @@ public class FB2AnnotationReader extends ZLXMLReaderAdapter {
|
||||||
|
|
||||||
public FB2AnnotationReader() {
|
public FB2AnnotationReader() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean dontCacheAttributeValues() {
|
public boolean dontCacheAttributeValues() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String readAnnotation(ZLFile file) {
|
public String readAnnotation(ZLFile file) {
|
||||||
myReadState = READ_NOTHING;
|
myReadState = READ_NOTHING;
|
||||||
myBuffer.delete(0, myBuffer.length());
|
myBuffer.delete(0, myBuffer.length());
|
||||||
|
@ -69,7 +69,7 @@ public class FB2AnnotationReader extends ZLXMLReaderAdapter {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean endElementHandler(String tag) {
|
public boolean endElementHandler(String tag) {
|
||||||
if (myReadState != READ_ANNOTATION) {
|
if (myReadState != READ_ANNOTATION) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -87,7 +87,7 @@ public class FB2AnnotationReader extends ZLXMLReaderAdapter {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void characterDataHandler(char[] data, int start, int length) {
|
public void characterDataHandler(char[] data, int start, int length) {
|
||||||
if (myReadState == READ_ANNOTATION) {
|
if (myReadState == READ_ANNOTATION) {
|
||||||
myBuffer.append(new String(data, start, length).trim());
|
myBuffer.append(new String(data, start, length).trim());
|
||||||
|
|
|
@ -110,7 +110,7 @@ class FB2CoverImage extends ZLImageProxy {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ final class FB2Tag {
|
||||||
public static final byte IMAGE = 23;
|
public static final byte IMAGE = 23;
|
||||||
public static final byte BINARY = 24;
|
public static final byte BINARY = 24;
|
||||||
public static final byte FICTIONBOOK = 25;
|
public static final byte FICTIONBOOK = 25;
|
||||||
|
|
||||||
public static final byte TITLE_INFO = 26;
|
public static final byte TITLE_INFO = 26;
|
||||||
public static final byte BOOK_TITLE = 27;
|
public static final byte BOOK_TITLE = 27;
|
||||||
public static final byte AUTHOR = 28;
|
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 HashMap<String, Byte> ourTagByName = new HashMap<String, Byte>(256, 0.2f);
|
||||||
private static final Byte ourUnknownTag;
|
private static final Byte ourUnknownTag;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
ourTagByName.put("unknown", UNKNOWN);
|
ourTagByName.put("unknown", UNKNOWN);
|
||||||
ourUnknownTag = (Byte)ourTagByName.get("unknown");
|
ourUnknownTag = (Byte)ourTagByName.get("unknown");
|
||||||
ourTagByName.put("p", P);
|
ourTagByName.put("p", P);
|
||||||
|
|
|
@ -67,10 +67,10 @@ public class HtmlReader extends BookReader implements ZLHtmlReader {
|
||||||
private int myOLCounter = 0;
|
private int myOLCounter = 0;
|
||||||
private byte[] myControls = new byte[10];
|
private byte[] myControls = new byte[10];
|
||||||
private byte myControlsNumber = 0;
|
private byte myControlsNumber = 0;
|
||||||
|
|
||||||
public HtmlReader(BookModel model) throws UnsupportedEncodingException {
|
public HtmlReader(BookModel model) throws UnsupportedEncodingException {
|
||||||
super(model);
|
super(model);
|
||||||
try {
|
try {
|
||||||
//String encoding = model.Book.getEncoding();
|
//String encoding = model.Book.getEncoding();
|
||||||
myAttributeDecoder = createDecoder();
|
myAttributeDecoder = createDecoder();
|
||||||
setByteDecoder(createDecoder());
|
setByteDecoder(createDecoder());
|
||||||
|
@ -138,7 +138,7 @@ public class HtmlReader extends BookReader implements ZLHtmlReader {
|
||||||
}
|
}
|
||||||
myControls[myControlsNumber++] = control;
|
myControls[myControlsNumber++] = control;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void closeControl(byte control) {
|
private void closeControl(byte control) {
|
||||||
for (int i = 0; i < myControlsNumber; i++) {
|
for (int i = 0; i < myControlsNumber; i++) {
|
||||||
addControl(myControls[i], false);
|
addControl(myControls[i], false);
|
||||||
|
@ -161,12 +161,12 @@ public class HtmlReader extends BookReader implements ZLHtmlReader {
|
||||||
myControls[i] = myControls[i + 1];
|
myControls[i] = myControls[i + 1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void startNewParagraph() {
|
private void startNewParagraph() {
|
||||||
endParagraph();
|
endParagraph();
|
||||||
beginParagraph(ZLTextParagraph.Kind.TEXT_PARAGRAPH);
|
beginParagraph(ZLTextParagraph.Kind.TEXT_PARAGRAPH);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void endElementHandler(String tagName) {
|
public final void endElementHandler(String tagName) {
|
||||||
endElementHandler(HtmlTag.getTagByName(tagName));
|
endElementHandler(HtmlTag.getTagByName(tagName));
|
||||||
}
|
}
|
||||||
|
@ -201,7 +201,7 @@ public class HtmlReader extends BookReader implements ZLHtmlReader {
|
||||||
case HtmlTag.HTML:
|
case HtmlTag.HTML:
|
||||||
//unsetCurrentTextModel();
|
//unsetCurrentTextModel();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HtmlTag.B:
|
case HtmlTag.B:
|
||||||
case HtmlTag.S:
|
case HtmlTag.S:
|
||||||
case HtmlTag.SUB:
|
case HtmlTag.SUB:
|
||||||
|
@ -219,11 +219,11 @@ public class HtmlReader extends BookReader implements ZLHtmlReader {
|
||||||
myOrderedListIsStarted = false;
|
myOrderedListIsStarted = false;
|
||||||
myOLCounter = 0;
|
myOLCounter = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HtmlTag.UL:
|
case HtmlTag.UL:
|
||||||
//myUnorderedListIsStarted = false;
|
//myUnorderedListIsStarted = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -271,7 +271,7 @@ public class HtmlReader extends BookReader implements ZLHtmlReader {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case HtmlTag.IMG: {
|
case HtmlTag.IMG: {
|
||||||
/*
|
/*
|
||||||
String ref = attributes.getStringValue(mySrcAttribute, myAttributeDecoder);
|
String ref = attributes.getStringValue(mySrcAttribute, myAttributeDecoder);
|
||||||
|
@ -287,7 +287,7 @@ public class HtmlReader extends BookReader implements ZLHtmlReader {
|
||||||
*/
|
*/
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case HtmlTag.B:
|
case HtmlTag.B:
|
||||||
case HtmlTag.S:
|
case HtmlTag.S:
|
||||||
case HtmlTag.SUB:
|
case HtmlTag.SUB:
|
||||||
|
@ -301,7 +301,7 @@ public class HtmlReader extends BookReader implements ZLHtmlReader {
|
||||||
case HtmlTag.I:
|
case HtmlTag.I:
|
||||||
openControl(myStyleTable[tag]);
|
openControl(myStyleTable[tag]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HtmlTag.H1:
|
case HtmlTag.H1:
|
||||||
case HtmlTag.H2:
|
case HtmlTag.H2:
|
||||||
case HtmlTag.H3:
|
case HtmlTag.H3:
|
||||||
|
@ -311,15 +311,15 @@ public class HtmlReader extends BookReader implements ZLHtmlReader {
|
||||||
startNewParagraph();
|
startNewParagraph();
|
||||||
openControl(myStyleTable[tag]);
|
openControl(myStyleTable[tag]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HtmlTag.OL:
|
case HtmlTag.OL:
|
||||||
myOrderedListIsStarted = true;
|
myOrderedListIsStarted = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HtmlTag.UL:
|
case HtmlTag.UL:
|
||||||
//myUnorderedListIsStarted = true;
|
//myUnorderedListIsStarted = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HtmlTag.LI:
|
case HtmlTag.LI:
|
||||||
startNewParagraph();
|
startNewParagraph();
|
||||||
if (myOrderedListIsStarted) {
|
if (myOrderedListIsStarted) {
|
||||||
|
@ -330,14 +330,14 @@ public class HtmlReader extends BookReader implements ZLHtmlReader {
|
||||||
addData(new char[] {'*', ' '});
|
addData(new char[] {'*', ' '});
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HtmlTag.SCRIPT:
|
case HtmlTag.SCRIPT:
|
||||||
case HtmlTag.SELECT:
|
case HtmlTag.SELECT:
|
||||||
case HtmlTag.STYLE:
|
case HtmlTag.STYLE:
|
||||||
endParagraph();
|
endParagraph();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HtmlTag.TR:
|
case HtmlTag.TR:
|
||||||
case HtmlTag.BR:
|
case HtmlTag.BR:
|
||||||
startNewParagraph();
|
startNewParagraph();
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -48,7 +48,7 @@ public final class HtmlTag {
|
||||||
public static final byte DIV = 23;
|
public static final byte DIV = 23;
|
||||||
public static final byte TR = 24;
|
public static final byte TR = 24;
|
||||||
public static final byte STYLE = 25;
|
public static final byte STYLE = 25;
|
||||||
|
|
||||||
public static final byte S = 26;
|
public static final byte S = 26;
|
||||||
public static final byte SUB = 27;
|
public static final byte SUB = 27;
|
||||||
public static final byte SUP = 28;
|
public static final byte SUP = 28;
|
||||||
|
@ -59,13 +59,13 @@ public final class HtmlTag {
|
||||||
public static final byte CITE = 33;
|
public static final byte CITE = 33;
|
||||||
|
|
||||||
public static final byte HR = 34;
|
public static final byte HR = 34;
|
||||||
|
|
||||||
// mobipocket specific tags
|
// mobipocket specific tags
|
||||||
public static final byte REFERENCE = 35;
|
public static final byte REFERENCE = 35;
|
||||||
public static final byte GUIDE = 36;
|
public static final byte GUIDE = 36;
|
||||||
|
|
||||||
public static final byte TAG_NUMBER = 37;
|
public static final byte TAG_NUMBER = 37;
|
||||||
|
|
||||||
private static final HashMap<String,Byte> ourTagByName = new HashMap<String,Byte>(256, 0.2f);
|
private static final HashMap<String,Byte> ourTagByName = new HashMap<String,Byte>(256, 0.2f);
|
||||||
private static final Byte ourUnknownTag;
|
private static final Byte ourUnknownTag;
|
||||||
|
|
||||||
|
|
|
@ -131,7 +131,7 @@ class NCXReader extends ZLXMLReaderAdapter {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean endElementHandler(String tag) {
|
public boolean endElementHandler(String tag) {
|
||||||
tag = tag.toLowerCase().intern();
|
tag = tag.toLowerCase().intern();
|
||||||
|
@ -166,7 +166,7 @@ class NCXReader extends ZLXMLReaderAdapter {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void characterDataHandler(char[] ch, int start, int length) {
|
public void characterDataHandler(char[] ch, int start, int length) {
|
||||||
if (myReadState == READ_TEXT) {
|
if (myReadState == READ_TEXT) {
|
||||||
|
|
|
@ -206,7 +206,7 @@ class OEBBookReader extends ZLXMLReaderAdapter implements XMLNamespaces {
|
||||||
private static final int READ_SPINE = 2;
|
private static final int READ_SPINE = 2;
|
||||||
private static final int READ_GUIDE = 3;
|
private static final int READ_GUIDE = 3;
|
||||||
private static final int READ_TOUR = 4;
|
private static final int READ_TOUR = 4;
|
||||||
|
|
||||||
private int myState;
|
private int myState;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -34,7 +34,7 @@ class OEBMetaInfoReader extends ZLXMLReaderAdapter implements XMLNamespaces {
|
||||||
|
|
||||||
private String mySeriesTitle = "";
|
private String mySeriesTitle = "";
|
||||||
private String mySeriesIndex = null;
|
private String mySeriesIndex = null;
|
||||||
|
|
||||||
private final ArrayList<String> myAuthorList = new ArrayList<String>();
|
private final ArrayList<String> myAuthorList = new ArrayList<String>();
|
||||||
private final ArrayList<String> myAuthorList2 = new ArrayList<String>();
|
private final ArrayList<String> myAuthorList2 = new ArrayList<String>();
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ public class MobipocketPlugin extends JavaFormatPlugin {
|
||||||
if (index != -1) {
|
if (index != -1) {
|
||||||
author = author.substring(index + 1).trim() +
|
author = author.substring(index + 1).trim() +
|
||||||
' ' +
|
' ' +
|
||||||
author.substring(0, index).trim();
|
author.substring(0, index).trim();
|
||||||
} else {
|
} else {
|
||||||
author = author.trim();
|
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 new ZLFileImage(MimeType.IMAGE_AUTO, file, ZLFileImage.ENCODING_NONE, start, len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
return null;
|
return null;
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -79,7 +79,7 @@ abstract class PalmDocLikeStream extends PdbStream {
|
||||||
}
|
}
|
||||||
myBufferOffset = 0;
|
myBufferOffset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class PdbHeader {
|
||||||
Flags = PdbUtil.readShort(stream);
|
Flags = PdbUtil.readShort(stream);
|
||||||
|
|
||||||
PdbUtil.skip(stream, 26);
|
PdbUtil.skip(stream, 26);
|
||||||
|
|
||||||
if (stream.read(buffer, 0, 8) != 8) {
|
if (stream.read(buffer, 0, 8) != 8) {
|
||||||
throw new IOException("PdbHeader: cannot reader palm id");
|
throw new IOException("PdbHeader: cannot reader palm id");
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ public abstract class PdbStream extends InputStream {
|
||||||
myBufferLength = 0;
|
myBufferLength = 0;
|
||||||
myBufferOffset = 0;
|
myBufferOffset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int read() {
|
public int read() {
|
||||||
if (!fillBuffer()) {
|
if (!fillBuffer()) {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -68,7 +68,7 @@ public abstract class PdbStream extends InputStream {
|
||||||
}
|
}
|
||||||
return (realSize > 0) ? realSize : -1;
|
return (realSize > 0) ? realSize : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void close() throws IOException {
|
public void close() throws IOException {
|
||||||
if (myBase != null) {
|
if (myBase != null) {
|
||||||
myBase.close();
|
myBase.close();
|
||||||
|
|
|
@ -220,7 +220,7 @@ public class XHTMLReader extends ZLXMLReaderAdapter {
|
||||||
@Override
|
@Override
|
||||||
public void characterDataHandler(char[] data, int start, int len) {
|
public void characterDataHandler(char[] data, int start, int len) {
|
||||||
if (myPreformatted) {
|
if (myPreformatted) {
|
||||||
final char first = data[start];
|
final char first = data[start];
|
||||||
if ((first == '\r') || (first == '\n')) {
|
if ((first == '\r') || (first == '\n')) {
|
||||||
myModelReader.addControl(FBTextKind.CODE, false);
|
myModelReader.addControl(FBTextKind.CODE, false);
|
||||||
myModelReader.endParagraph();
|
myModelReader.endParagraph();
|
||||||
|
|
|
@ -175,7 +175,7 @@ public class FileTree extends LibraryTree {
|
||||||
final boolean isDir = file0.isDirectory();
|
final boolean isDir = file0.isDirectory();
|
||||||
if (isDir != file1.isDirectory()) {
|
if (isDir != file1.isDirectory()) {
|
||||||
return isDir ? -1 : 1;
|
return isDir ? -1 : 1;
|
||||||
}
|
}
|
||||||
return file0.getShortName().compareToIgnoreCase(file1.getShortName());
|
return file0.getShortName().compareToIgnoreCase(file1.getShortName());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -430,7 +430,7 @@ public final class Library {
|
||||||
);
|
);
|
||||||
file.setCached(false);
|
file.setCached(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Step 4: add help file
|
// Step 4: add help file
|
||||||
try {
|
try {
|
||||||
final ZLFile helpFile = getHelpFile();
|
final ZLFile helpFile = getHelpFile();
|
||||||
|
@ -521,7 +521,7 @@ public final class Library {
|
||||||
fireModelChangedEvent(ChangeListener.Code.Found);
|
fireModelChangedEvent(ChangeListener.Code.Found);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
FirstLevelTree newSearchResults = null;
|
FirstLevelTree newSearchResults = null;
|
||||||
final List<Book> booksCopy;
|
final List<Book> booksCopy;
|
||||||
synchronized (myBooks) {
|
synchronized (myBooks) {
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class NetworkBookItem extends NetworkItem {
|
||||||
public final String SortKey;
|
public final String SortKey;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates new AuthorData instance.
|
* Creates new AuthorData instance.
|
||||||
*
|
*
|
||||||
* @param displayName author's name. Must be not <code>null</code>.
|
* @param displayName author's name. Must be not <code>null</code>.
|
||||||
* @param sortKey string that defines sorting order of book's authors.
|
* @param sortKey string that defines sorting order of book's authors.
|
||||||
|
|
|
@ -42,7 +42,7 @@ public final class NetworkBookItemComparator implements Comparator<NetworkItem>
|
||||||
|
|
||||||
final LinkedList<NetworkBookItem.AuthorData> authors0 = book0.Authors;
|
final LinkedList<NetworkBookItem.AuthorData> authors0 = book0.Authors;
|
||||||
final LinkedList<NetworkBookItem.AuthorData> authors1 = book1.Authors;
|
final LinkedList<NetworkBookItem.AuthorData> authors1 = book1.Authors;
|
||||||
|
|
||||||
final boolean authors0empty = authors0.size() == 0;
|
final boolean authors0empty = authors0.size() == 0;
|
||||||
final boolean authors1empty = authors1.size() == 0;
|
final boolean authors1empty = authors1.size() == 0;
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@ public abstract class NetworkCatalogItem extends NetworkItem {
|
||||||
* @param summary description of this library item. Can be <code>null</code>.
|
* @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 urls collection of item-related URLs. Can be <code>null</code>.
|
||||||
* @param accessibility value defines when this library item will be accessible
|
* @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
|
* @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) {
|
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
|
* Performs all necessary operations with NetworkOperationData and NetworkRequest
|
||||||
* to complete loading children items.
|
* to complete loading children items.
|
||||||
*
|
*
|
||||||
* @param data Network operation data instance
|
* @param data Network operation data instance
|
||||||
* @param networkRequest initial network request
|
* @param networkRequest initial network request
|
||||||
*
|
*
|
||||||
* @throws ZLNetworkException when network operation couldn't be completed
|
* @throws ZLNetworkException when network operation couldn't be completed
|
||||||
*/
|
*/
|
||||||
protected final void doLoadChildren(NetworkOperationData data, ZLNetworkRequest networkRequest) throws ZLNetworkException {
|
protected final void doLoadChildren(NetworkOperationData data, ZLNetworkRequest networkRequest) throws ZLNetworkException {
|
||||||
|
|
|
@ -33,7 +33,7 @@ public abstract class NetworkURLCatalogItem extends NetworkCatalogItem {
|
||||||
* @param summary description of this library item. Can be <code>null</code>.
|
* @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 urls collection of item-related URLs. Can be <code>null</code>.
|
||||||
* @param accessibility value defines when this library item will be accessible
|
* @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.
|
* @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) {
|
protected NetworkURLCatalogItem(INetworkLink link, CharSequence title, CharSequence summary, UrlInfoCollection<?> urls, Accessibility accessibility, int flags) {
|
||||||
|
|
|
@ -26,14 +26,14 @@ import org.geometerplus.fbreader.network.atom.*;
|
||||||
public abstract class AbstractATOMFeedHandler implements ATOMFeedHandler {
|
public abstract class AbstractATOMFeedHandler implements ATOMFeedHandler {
|
||||||
public void processFeedStart() {
|
public void processFeedStart() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void processFeedEnd() {
|
public void processFeedEnd() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean processFeedMetadata(ATOMFeedMetadata feed, boolean beforeEntries) {
|
public boolean processFeedMetadata(ATOMFeedMetadata feed, boolean beforeEntries) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean processFeedEntry(ATOMEntry entry) {
|
public boolean processFeedEntry(ATOMEntry entry) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -172,7 +172,7 @@ public class LitResBookshelfItem extends NetworkURLCatalogItem {
|
||||||
final LitResAuthenticationManager mgr =
|
final LitResAuthenticationManager mgr =
|
||||||
(LitResAuthenticationManager)Link.authenticationManager();
|
(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???
|
// and let exception fly through???
|
||||||
if (!mgr.mayBeAuthorised(true)) {
|
if (!mgr.mayBeAuthorised(true)) {
|
||||||
throw new ZLNetworkException(NetworkException.ERROR_AUTHENTICATION_FAILED);
|
throw new ZLNetworkException(NetworkException.ERROR_AUTHENTICATION_FAILED);
|
||||||
|
|
|
@ -112,7 +112,7 @@ class LitResXMLReader extends LitResAuthenticationXMLReader {
|
||||||
myUrls.addInfo(new UrlInfo(
|
myUrls.addInfo(new UrlInfo(
|
||||||
UrlInfo.Type.Image, attributes.getValue("cover_preview"), MimeType.IMAGE_AUTO
|
UrlInfo.Type.Image, attributes.getValue("cover_preview"), MimeType.IMAGE_AUTO
|
||||||
));
|
));
|
||||||
|
|
||||||
myUrls.addInfo(new BookUrlInfo(
|
myUrls.addInfo(new BookUrlInfo(
|
||||||
UrlInfo.Type.BookConditional,
|
UrlInfo.Type.BookConditional,
|
||||||
BookUrlInfo.Format.FB2_ZIP,
|
BookUrlInfo.Format.FB2_ZIP,
|
||||||
|
@ -197,7 +197,7 @@ class LitResXMLReader extends LitResAuthenticationXMLReader {
|
||||||
break;
|
break;
|
||||||
case BOOK:
|
case BOOK:
|
||||||
if (TAG_BOOK == tag) {
|
if (TAG_BOOK == tag) {
|
||||||
myUrls.addInfo(new UrlInfo(
|
myUrls.addInfo(new UrlInfo(
|
||||||
UrlInfo.Type.SingleEntry,
|
UrlInfo.Type.SingleEntry,
|
||||||
"http://data.fbreader.org/catalogs/litres2/full.php5?id=" + myBookId,
|
"http://data.fbreader.org/catalogs/litres2/full.php5?id=" + myBookId,
|
||||||
MimeType.APP_ATOM_XML_ENTRY
|
MimeType.APP_ATOM_XML_ENTRY
|
||||||
|
@ -216,7 +216,7 @@ class LitResXMLReader extends LitResAuthenticationXMLReader {
|
||||||
myIndexInSeries,
|
myIndexInSeries,
|
||||||
myUrls
|
myUrls
|
||||||
));
|
));
|
||||||
|
|
||||||
myBookId = myTitle = /*myLanguage = myDate = */mySeriesTitle = null;
|
myBookId = myTitle = /*myLanguage = myDate = */mySeriesTitle = null;
|
||||||
mySummary = null;
|
mySummary = null;
|
||||||
myIndexInSeries = 0;
|
myIndexInSeries = 0;
|
||||||
|
@ -285,7 +285,7 @@ class LitResXMLReader extends LitResAuthenticationXMLReader {
|
||||||
LitResGenreMap::Instance().genresMap();
|
LitResGenreMap::Instance().genresMap();
|
||||||
const std::map<shared_ptr<LitResGenre>,std::string> &genresTitles =
|
const std::map<shared_ptr<LitResGenre>,std::string> &genresTitles =
|
||||||
LitResGenreMap::Instance().genresTitles();
|
LitResGenreMap::Instance().genresTitles();
|
||||||
|
|
||||||
std::map<std::string, shared_ptr<LitResGenre> >::const_iterator it = genresMap.find(myBuffer);
|
std::map<std::string, shared_ptr<LitResGenre> >::const_iterator it = genresMap.find(myBuffer);
|
||||||
if (it != genresMap.end()) {
|
if (it != genresMap.end()) {
|
||||||
std::map<shared_ptr<LitResGenre>, std::string>::const_iterator jt = genresTitles.find(it->second);
|
std::map<shared_ptr<LitResGenre>, std::string>::const_iterator jt = genresTitles.find(it->second);
|
||||||
|
|
|
@ -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.
|
* 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 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.
|
* that will be read using this instance of the reader.
|
||||||
*/
|
*/
|
||||||
OPDSFeedHandler(String baseURL, OPDSCatalogItem.State result) {
|
OPDSFeedHandler(String baseURL, OPDSCatalogItem.State result) {
|
||||||
|
|
|
@ -39,7 +39,7 @@ class OPDSLinkXMLReader extends OPDSXMLReader implements OPDSConstants {
|
||||||
private String myAuthenticationType;
|
private String myAuthenticationType;
|
||||||
private final LinkedList<URLRewritingRule> myUrlRewritingRules = new LinkedList<URLRewritingRule>();
|
private final LinkedList<URLRewritingRule> myUrlRewritingRules = new LinkedList<URLRewritingRule>();
|
||||||
private final HashMap<RelationAlias, String> myRelationAliases = new HashMap<RelationAlias, String>();
|
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() {
|
List<INetworkLink> links() {
|
||||||
return myLinks;
|
return myLinks;
|
||||||
}
|
}
|
||||||
|
@ -124,7 +124,7 @@ class OPDSLinkXMLReader extends OPDSXMLReader implements OPDSConstants {
|
||||||
if (siteName != null && title != null && infos.getInfo(UrlInfo.Type.Catalog) != null) {
|
if (siteName != null && title != null && infos.getInfo(UrlInfo.Type.Catalog) != null) {
|
||||||
myLinks.add(link(id, siteName, title, summary, language, infos));
|
myLinks.add(link(id, siteName, title, summary, language, infos));
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private INetworkLink link(
|
private INetworkLink link(
|
||||||
|
|
|
@ -103,7 +103,7 @@ public abstract class OPDSNetworkLink extends AbstractNetworkLink {
|
||||||
).read(inputStream);
|
).read(inputStream);
|
||||||
|
|
||||||
if (result.Loader.confirmInterruption() && result.LastLoadedId != null) {
|
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;
|
result.LastLoadedId = null;
|
||||||
} else {
|
} else {
|
||||||
result.Loader.getTree().confirmAllItems();
|
result.Loader.getTree().confirmAllItems();
|
||||||
|
|
|
@ -22,7 +22,7 @@ package org.geometerplus.fbreader.tips;
|
||||||
public class Tip {
|
public class Tip {
|
||||||
public final CharSequence Title;
|
public final CharSequence Title;
|
||||||
public final CharSequence Content;
|
public final CharSequence Content;
|
||||||
|
|
||||||
Tip(CharSequence title, CharSequence content) {
|
Tip(CharSequence title, CharSequence content) {
|
||||||
Title = title;
|
Title = title;
|
||||||
Content = content;
|
Content = content;
|
||||||
|
|
|
@ -166,7 +166,7 @@ public abstract class ZLApplication {
|
||||||
|
|
||||||
public final boolean hasActionForKey(int key, boolean longPress) {
|
public final boolean hasActionForKey(int key, boolean longPress) {
|
||||||
final String actionId = keyBindings().getBinding(key, 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) {
|
public final boolean runActionByKey(int key, boolean longPress) {
|
||||||
|
@ -295,7 +295,7 @@ public abstract class ZLApplication {
|
||||||
addTimerTaskInternal(runnable, periodMilliseconds);
|
addTimerTaskInternal(runnable, periodMilliseconds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void removeTimerTask(Runnable runnable) {
|
public final void removeTimerTask(Runnable runnable) {
|
||||||
synchronized (myTimerLock) {
|
synchronized (myTimerLock) {
|
||||||
|
|
|
@ -38,7 +38,7 @@ abstract public class ZLApplicationWindow {
|
||||||
abstract protected void processException(Exception e);
|
abstract protected void processException(Exception e);
|
||||||
|
|
||||||
abstract protected void refresh();
|
abstract protected void refresh();
|
||||||
|
|
||||||
abstract protected ZLViewWidget getViewWidget();
|
abstract protected ZLViewWidget getViewWidget();
|
||||||
|
|
||||||
abstract protected void close();
|
abstract protected void close();
|
||||||
|
|
|
@ -34,7 +34,7 @@ abstract class FilteredEncodingCollection extends EncodingCollection {
|
||||||
ZLResourceFile.createResourceFile("encodings/Encodings.xml")
|
ZLResourceFile.createResourceFile("encodings/Encodings.xml")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract boolean isEncodingSupported(String name);
|
public abstract boolean isEncodingSupported(String name);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -56,9 +56,9 @@ public abstract class ZLArchiveEntryFile extends ZLFile {
|
||||||
}
|
}
|
||||||
entryName = normalizeEntryName(entryName);
|
entryName = normalizeEntryName(entryName);
|
||||||
switch (archive.myArchiveType & ArchiveType.ARCHIVE) {
|
switch (archive.myArchiveType & ArchiveType.ARCHIVE) {
|
||||||
case ArchiveType.ZIP:
|
case ArchiveType.ZIP:
|
||||||
return new ZLZipEntryFile(archive, entryName);
|
return new ZLZipEntryFile(archive, entryName);
|
||||||
case ArchiveType.TAR:
|
case ArchiveType.TAR:
|
||||||
return new ZLTarEntryFile(archive, entryName);
|
return new ZLTarEntryFile(archive, entryName);
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
|
@ -78,23 +78,23 @@ public abstract class ZLArchiveEntryFile extends ZLFile {
|
||||||
|
|
||||||
protected final ZLFile myParent;
|
protected final ZLFile myParent;
|
||||||
protected final String myName;
|
protected final String myName;
|
||||||
|
|
||||||
protected ZLArchiveEntryFile(ZLFile parent, String name) {
|
protected ZLArchiveEntryFile(ZLFile parent, String name) {
|
||||||
myParent = parent;
|
myParent = parent;
|
||||||
myName = name;
|
myName = name;
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isDirectory() {
|
public boolean isDirectory() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPath() {
|
public String getPath() {
|
||||||
return myParent.getPath() + ":" + myName;
|
return myParent.getPath() + ":" + myName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getLongName() {
|
public String getLongName() {
|
||||||
return myName;
|
return myName;
|
||||||
|
|
|
@ -34,7 +34,7 @@ public abstract class ZLFile {
|
||||||
int TAR = 0x0200;
|
int TAR = 0x0200;
|
||||||
int ARCHIVE = 0xff00;
|
int ARCHIVE = 0xff00;
|
||||||
};
|
};
|
||||||
|
|
||||||
private String myExtension;
|
private String myExtension;
|
||||||
private String myShortName;
|
private String myShortName;
|
||||||
protected int myArchiveType;
|
protected int myArchiveType;
|
||||||
|
@ -72,7 +72,7 @@ public abstract class ZLFile {
|
||||||
}
|
}
|
||||||
myArchiveType = archiveType;
|
myArchiveType = archiveType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ZLFile createFile(ZLFile parent, String name) {
|
public static ZLFile createFile(ZLFile parent, String name) {
|
||||||
ZLFile file = null;
|
ZLFile file = null;
|
||||||
if (parent == null) {
|
if (parent == null) {
|
||||||
|
@ -151,9 +151,9 @@ public abstract class ZLFile {
|
||||||
}
|
}
|
||||||
|
|
||||||
public final boolean isCompressed() {
|
public final boolean isCompressed() {
|
||||||
return (0 != (myArchiveType & ArchiveType.COMPRESSED));
|
return (0 != (myArchiveType & ArchiveType.COMPRESSED));
|
||||||
}
|
}
|
||||||
|
|
||||||
public final boolean isArchive() {
|
public final boolean isArchive() {
|
||||||
return (0 != (myArchiveType & ArchiveType.ARCHIVE));
|
return (0 != (myArchiveType & ArchiveType.ARCHIVE));
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,17 +31,17 @@ public abstract class ZLResourceFile extends ZLFile {
|
||||||
}
|
}
|
||||||
|
|
||||||
private final String myPath;
|
private final String myPath;
|
||||||
|
|
||||||
protected ZLResourceFile(String path) {
|
protected ZLResourceFile(String path) {
|
||||||
myPath = path;
|
myPath = path;
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPath() {
|
public String getPath() {
|
||||||
return myPath;
|
return myPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getLongName() {
|
public String getLongName() {
|
||||||
return myPath.substring(myPath.lastIndexOf('/') + 1);
|
return myPath.substring(myPath.lastIndexOf('/') + 1);
|
||||||
|
|
|
@ -50,7 +50,7 @@ class ZLTarHeader {
|
||||||
if (stream.skip(24) != 24) {
|
if (stream.skip(24) != 24) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final byte[] fileSizeString = new byte[12];
|
final byte[] fileSizeString = new byte[12];
|
||||||
if (stream.read(fileSizeString) != 12) {
|
if (stream.read(fileSizeString) != 12) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -64,7 +64,7 @@ class ZLTarHeader {
|
||||||
Size *= 8;
|
Size *= 8;
|
||||||
Size += digit - (byte)'0';
|
Size += digit - (byte)'0';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stream.skip(20) != 20) {
|
if (stream.skip(20) != 20) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -73,12 +73,12 @@ class ZLTarHeader {
|
||||||
if (linkFlag == -1) {
|
if (linkFlag == -1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
IsRegularFile = (linkFlag == 0) || (linkFlag == (byte)'0');
|
IsRegularFile = linkFlag == 0 || linkFlag == (byte)'0';
|
||||||
|
|
||||||
stream.skip(355);
|
stream.skip(355);
|
||||||
|
|
||||||
if (((linkFlag == (byte)'L') ||
|
if ((linkFlag == (byte)'L' || linkFlag == (byte)'K')
|
||||||
(linkFlag == (byte)'K')) && (Name == "././@LongLink") && (Size < 10240)) {
|
&& "././@LongLink".equals(Name) && Size < 10240) {
|
||||||
final byte[] nameBuffer = new byte[Size - 1];
|
final byte[] nameBuffer = new byte[Size - 1];
|
||||||
stream.read(nameBuffer);
|
stream.read(nameBuffer);
|
||||||
Name = getStringFromByteArray(nameBuffer);
|
Name = getStringFromByteArray(nameBuffer);
|
||||||
|
|
|
@ -107,7 +107,7 @@ public final class ZLByteBuffer {
|
||||||
public boolean equalsToLCString(String lcPattern) {
|
public boolean equalsToLCString(String lcPattern) {
|
||||||
return (myLength == lcPattern.length()) &&
|
return (myLength == lcPattern.length()) &&
|
||||||
lcPattern.equals(new String(myData, 0, myLength).toLowerCase());
|
lcPattern.equals(new String(myData, 0, myLength).toLowerCase());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Object myConverterLock = new Object();
|
private static final Object myConverterLock = new Object();
|
||||||
private static char[] myConverterBuffer = new char[20];
|
private static char[] myConverterBuffer = new char[20];
|
||||||
|
|
|
@ -46,7 +46,7 @@ final class ZLHtmlParser {
|
||||||
private static final byte D_ATTRIBUTE_VALUE = 18;
|
private static final byte D_ATTRIBUTE_VALUE = 18;
|
||||||
private static final byte SCRIPT = 19;
|
private static final byte SCRIPT = 19;
|
||||||
private static final byte ENTITY_REF = 20;
|
private static final byte ENTITY_REF = 20;
|
||||||
|
|
||||||
private static ZLByteBuffer unique(HashMap<ZLByteBuffer,ZLByteBuffer> strings, ZLByteBuffer container) {
|
private static ZLByteBuffer unique(HashMap<ZLByteBuffer,ZLByteBuffer> strings, ZLByteBuffer container) {
|
||||||
ZLByteBuffer s = strings.get(container);
|
ZLByteBuffer s = strings.get(container);
|
||||||
if (s == null) {
|
if (s == null) {
|
||||||
|
@ -79,7 +79,7 @@ final class ZLHtmlParser {
|
||||||
//boolean html = false;
|
//boolean html = false;
|
||||||
int bufferOffset = 0;
|
int bufferOffset = 0;
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
|
|
||||||
byte state = START_DOCUMENT;
|
byte state = START_DOCUMENT;
|
||||||
while (true) {
|
while (true) {
|
||||||
final int count = stream.read(buffer);
|
final int count = stream.read(buffer);
|
||||||
|
@ -92,7 +92,7 @@ final class ZLHtmlParser {
|
||||||
int startPosition = 0;
|
int startPosition = 0;
|
||||||
try {
|
try {
|
||||||
for (int i = -1;;) {
|
for (int i = -1;;) {
|
||||||
mainSwitchLabel:
|
mainSwitchLabel:
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case START_DOCUMENT:
|
case START_DOCUMENT:
|
||||||
while (buffer[++i] != '<') {}
|
while (buffer[++i] != '<') {}
|
||||||
|
@ -156,7 +156,7 @@ mainSwitchLabel:
|
||||||
break mainSwitchLabel;
|
break mainSwitchLabel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
case COMMENT :
|
case COMMENT :
|
||||||
while (true) {
|
while (true) {
|
||||||
switch (buffer[++i]) {
|
switch (buffer[++i]) {
|
||||||
|
@ -269,7 +269,7 @@ mainSwitchLabel:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WS_AFTER_END_TAG_NAME:
|
case WS_AFTER_END_TAG_NAME:
|
||||||
switch (buffer[++i]) {
|
switch (buffer[++i]) {
|
||||||
case '>':
|
case '>':
|
||||||
|
@ -289,7 +289,7 @@ mainSwitchLabel:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ATTRIBUTE_NAME:
|
case ATTRIBUTE_NAME:
|
||||||
while (true) {
|
while (true) {
|
||||||
switch (buffer[++i]) {
|
switch (buffer[++i]) {
|
||||||
|
@ -324,7 +324,7 @@ mainSwitchLabel:
|
||||||
break;
|
break;
|
||||||
case '\t' :
|
case '\t' :
|
||||||
break;
|
break;
|
||||||
case '\n' :
|
case '\n' :
|
||||||
break;
|
break;
|
||||||
case '\'':
|
case '\'':
|
||||||
state = S_ATTRIBUTE_VALUE;
|
state = S_ATTRIBUTE_VALUE;
|
||||||
|
@ -343,7 +343,7 @@ mainSwitchLabel:
|
||||||
case DEFAULT_ATTRIBUTE_VALUE:
|
case DEFAULT_ATTRIBUTE_VALUE:
|
||||||
while (true) {
|
while (true) {
|
||||||
i++;
|
i++;
|
||||||
if ((buffer[i] == ' ') || (buffer[i] == '\'')
|
if ((buffer[i] == ' ') || (buffer[i] == '\'')
|
||||||
|| (buffer[i] == '"') || (buffer[i] == '>')) {
|
|| (buffer[i] == '"') || (buffer[i] == '>')) {
|
||||||
attributeValue.append(buffer, startPosition, i - startPosition);
|
attributeValue.append(buffer, startPosition, i - startPosition);
|
||||||
attributes.put(unique(strings, attributeName), new ZLByteBuffer(attributeValue));
|
attributes.put(unique(strings, attributeName), new ZLByteBuffer(attributeValue));
|
||||||
|
@ -360,7 +360,7 @@ mainSwitchLabel:
|
||||||
break mainSwitchLabel;
|
break mainSwitchLabel;
|
||||||
case '>':
|
case '>':
|
||||||
ZLByteBuffer stringTagName = unique(strings, tagName);
|
ZLByteBuffer stringTagName = unique(strings, tagName);
|
||||||
|
|
||||||
processStartTag(htmlReader, stringTagName, offset, attributes);
|
processStartTag(htmlReader, stringTagName, offset, attributes);
|
||||||
if (stringTagName.equalsToLCString("script")) {
|
if (stringTagName.equalsToLCString("script")) {
|
||||||
scriptOpened = true;
|
scriptOpened = true;
|
||||||
|
@ -371,7 +371,7 @@ mainSwitchLabel:
|
||||||
startPosition = i + 1;
|
startPosition = i + 1;
|
||||||
break mainSwitchLabel;
|
break mainSwitchLabel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case D_ATTRIBUTE_VALUE:
|
case D_ATTRIBUTE_VALUE:
|
||||||
while (true) {
|
while (true) {
|
||||||
switch (buffer[++i]) {
|
switch (buffer[++i]) {
|
||||||
|
@ -383,7 +383,7 @@ mainSwitchLabel:
|
||||||
break mainSwitchLabel;
|
break mainSwitchLabel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
case S_ATTRIBUTE_VALUE:
|
case S_ATTRIBUTE_VALUE:
|
||||||
while (true) {
|
while (true) {
|
||||||
switch (buffer[++i]) {
|
switch (buffer[++i]) {
|
||||||
|
|
|
@ -25,111 +25,111 @@ import org.geometerplus.zlibrary.core.filesystem.ZLFile;
|
||||||
import org.geometerplus.zlibrary.core.util.*;
|
import org.geometerplus.zlibrary.core.util.*;
|
||||||
|
|
||||||
public class ZLFileImage extends ZLSingleImage {
|
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_NONE = "";
|
||||||
public static final String ENCODING_HEX = "hex";
|
public static final String ENCODING_HEX = "hex";
|
||||||
public static final String ENCODING_BASE64 = "base64";
|
public static final String ENCODING_BASE64 = "base64";
|
||||||
|
|
||||||
public static ZLFileImage byUrlPath(String urlPath) {
|
public static ZLFileImage byUrlPath(String urlPath) {
|
||||||
try {
|
try {
|
||||||
final String[] data = urlPath.split("\000");
|
final String[] data = urlPath.split("\000");
|
||||||
int count = Integer.parseInt(data[2]);
|
int count = Integer.parseInt(data[2]);
|
||||||
int[] offsets = new int[count];
|
int[] offsets = new int[count];
|
||||||
int[] lengths = new int[count];
|
int[] lengths = new int[count];
|
||||||
for (int i = 0; i < count; ++i) {
|
for (int i = 0; i < count; ++i) {
|
||||||
offsets[i] = Integer.parseInt(data[3 + i]);
|
offsets[i] = Integer.parseInt(data[3 + i]);
|
||||||
lengths[i] = Integer.parseInt(data[3 + count + i]);
|
lengths[i] = Integer.parseInt(data[3 + count + i]);
|
||||||
}
|
}
|
||||||
return new ZLFileImage(
|
return new ZLFileImage(
|
||||||
MimeType.IMAGE_AUTO,
|
MimeType.IMAGE_AUTO,
|
||||||
ZLFile.createFileByPath(data[0]),
|
ZLFile.createFileByPath(data[0]),
|
||||||
data[1],
|
data[1],
|
||||||
offsets,
|
offsets,
|
||||||
lengths
|
lengths
|
||||||
);
|
);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final ZLFile myFile;
|
private final ZLFile myFile;
|
||||||
private final String myEncoding;
|
private final String myEncoding;
|
||||||
private final int[] myOffsets;
|
private final int[] myOffsets;
|
||||||
private final int[] myLengths;
|
private final int[] myLengths;
|
||||||
|
|
||||||
public ZLFileImage(String mimeType, ZLFile file, String encoding, int[] offsets, int[] lengths) {
|
public ZLFileImage(String mimeType, ZLFile file, String encoding, int[] offsets, int[] lengths) {
|
||||||
this(MimeType.get(mimeType), file, encoding, offsets, lengths);
|
this(MimeType.get(mimeType), file, encoding, offsets, lengths);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ZLFileImage(MimeType mimeType, ZLFile file, String encoding, int[] offsets, int[] lengths) {
|
public ZLFileImage(MimeType mimeType, ZLFile file, String encoding, int[] offsets, int[] lengths) {
|
||||||
super(mimeType);
|
super(mimeType);
|
||||||
myFile = file;
|
myFile = file;
|
||||||
myEncoding = encoding != null ? encoding : ENCODING_NONE;
|
myEncoding = encoding != null ? encoding : ENCODING_NONE;
|
||||||
myOffsets = offsets;
|
myOffsets = offsets;
|
||||||
myLengths = lengths;
|
myLengths = lengths;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ZLFileImage(String mimeType, ZLFile file, String encoding, int offset, int length) {
|
public ZLFileImage(String mimeType, ZLFile file, String encoding, int offset, int length) {
|
||||||
this(MimeType.get(mimeType), file, encoding, offset, length);
|
this(MimeType.get(mimeType), file, encoding, offset, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ZLFileImage(MimeType mimeType, ZLFile file, String encoding, int offset, int length) {
|
public ZLFileImage(MimeType mimeType, ZLFile file, String encoding, int offset, int length) {
|
||||||
super(mimeType);
|
super(mimeType);
|
||||||
myFile = file;
|
myFile = file;
|
||||||
myEncoding = encoding != null ? encoding : ENCODING_NONE;
|
myEncoding = encoding != null ? encoding : ENCODING_NONE;
|
||||||
myOffsets = new int[1];
|
myOffsets = new int[1];
|
||||||
myLengths = new int[1];
|
myLengths = new int[1];
|
||||||
myOffsets[0] = offset;
|
myOffsets[0] = offset;
|
||||||
myLengths[0] = length;
|
myLengths[0] = length;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ZLFileImage(MimeType mimeType, ZLFile file) {
|
public ZLFileImage(MimeType mimeType, ZLFile file) {
|
||||||
this(mimeType, file, ENCODING_NONE, 0, (int)file.size());
|
this(mimeType, file, ENCODING_NONE, 0, (int)file.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getURI() {
|
public String getURI() {
|
||||||
String result = SCHEME + "://" + myFile.getPath() + "\000" + myEncoding + "\000" + myOffsets.length;
|
String result = SCHEME + "://" + myFile.getPath() + "\000" + myEncoding + "\000" + myOffsets.length;
|
||||||
for (int offset : myOffsets) {
|
for (int offset : myOffsets) {
|
||||||
result += "\000" + offset;
|
result += "\000" + offset;
|
||||||
}
|
}
|
||||||
for (int length : myLengths) {
|
for (int length : myLengths) {
|
||||||
result += "\000" + length;
|
result += "\000" + length;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InputStream inputStream() {
|
public InputStream inputStream() {
|
||||||
try {
|
try {
|
||||||
final InputStream stream;
|
final InputStream stream;
|
||||||
if (myOffsets.length == 1) {
|
if (myOffsets.length == 1) {
|
||||||
final int offset = myOffsets[0];
|
final int offset = myOffsets[0];
|
||||||
final int length = myLengths[0];
|
final int length = myLengths[0];
|
||||||
stream = new SliceInputStream(myFile.getInputStream(), offset, length != 0 ? length : Integer.MAX_VALUE);
|
stream = new SliceInputStream(myFile.getInputStream(), offset, length != 0 ? length : Integer.MAX_VALUE);
|
||||||
} else {
|
} else {
|
||||||
final InputStream[] streams = new InputStream[myOffsets.length];
|
final InputStream[] streams = new InputStream[myOffsets.length];
|
||||||
for (int i = 0; i < myOffsets.length; ++i) {
|
for (int i = 0; i < myOffsets.length; ++i) {
|
||||||
final int offset = myOffsets[i];
|
final int offset = myOffsets[i];
|
||||||
final int length = myLengths[i];
|
final int length = myLengths[i];
|
||||||
streams[i] = new SliceInputStream(myFile.getInputStream(), offset, length != 0 ? length : Integer.MAX_VALUE);
|
streams[i] = new SliceInputStream(myFile.getInputStream(), offset, length != 0 ? length : Integer.MAX_VALUE);
|
||||||
}
|
}
|
||||||
stream = new MergedInputStream(streams);
|
stream = new MergedInputStream(streams);
|
||||||
}
|
}
|
||||||
if (ENCODING_NONE.equals(myEncoding)) {
|
if (ENCODING_NONE.equals(myEncoding)) {
|
||||||
return stream;
|
return stream;
|
||||||
} else if (ENCODING_HEX.equals(myEncoding)) {
|
} else if (ENCODING_HEX.equals(myEncoding)) {
|
||||||
return new HexInputStream(stream);
|
return new HexInputStream(stream);
|
||||||
} else if (ENCODING_BASE64.equals(myEncoding)) {
|
} else if (ENCODING_BASE64.equals(myEncoding)) {
|
||||||
return new Base64InputStream(stream);
|
return new Base64InputStream(stream);
|
||||||
} else {
|
} else {
|
||||||
System.err.println("unsupported encoding: " + myEncoding);
|
System.err.println("unsupported encoding: " + myEncoding);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ public abstract class ZLImageManager {
|
||||||
|
|
||||||
public abstract ZLImageData getImageData(ZLImage image);
|
public abstract ZLImageData getImageData(ZLImage image);
|
||||||
protected abstract void startImageLoading(ZLLoadableImage image, Runnable postLoadingRunnable);
|
protected abstract void startImageLoading(ZLLoadableImage image, Runnable postLoadingRunnable);
|
||||||
|
|
||||||
protected final static class PalmImageHeader {
|
protected final static class PalmImageHeader {
|
||||||
public final int Width;
|
public final int Width;
|
||||||
public final int Height;
|
public final int Height;
|
||||||
|
@ -40,7 +40,7 @@ public abstract class ZLImageManager {
|
||||||
public final int Flags;
|
public final int Flags;
|
||||||
public final byte BitsPerPixel;
|
public final byte BitsPerPixel;
|
||||||
public final byte CompressionType;
|
public final byte CompressionType;
|
||||||
|
|
||||||
public PalmImageHeader(byte [] byteData) {
|
public PalmImageHeader(byte [] byteData) {
|
||||||
Width = uShort(byteData, 0);
|
Width = uShort(byteData, 0);
|
||||||
Height = uShort(byteData, 2);
|
Height = uShort(byteData, 2);
|
||||||
|
@ -50,12 +50,12 @@ public abstract class ZLImageManager {
|
||||||
CompressionType = (byte) (((Flags & 0x8000) != 0) ? byteData[13] : 0xFF);
|
CompressionType = (byte) (((Flags & 0x8000) != 0) ? byteData[13] : 0xFF);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static int PalmImage8bitColormap[][] = {
|
protected static int PalmImage8bitColormap[][] = {
|
||||||
{255, 255, 255 }, { 255, 204, 255 }, { 255, 153, 255 }, { 255, 102, 255 },
|
{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, 51, 255 }, { 255, 0, 255 }, { 255, 255, 204 }, { 255, 204, 204 },
|
||||||
{ 255, 153, 204 }, { 255, 102, 204 }, { 255, 51, 204 }, { 255, 0, 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, 153 }, { 255, 204, 153 }, { 255, 153, 153 }, { 255, 102, 153 },
|
||||||
{ 255, 51, 153 }, { 255, 0, 153 }, { 204, 255, 255 }, { 204, 204, 255 },
|
{ 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, 153, 255 }, { 204, 102, 255 }, { 204, 51, 255 }, { 204, 0, 255 },
|
||||||
{ 204, 255, 204 }, { 204, 204, 204 }, { 204, 153, 204 }, { 204, 102, 204 },
|
{ 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 },
|
||||||
{ 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) {
|
private static int uShort(byte [] byteData, int offset) {
|
||||||
return ((byteData[offset] & 0xFF) << 8) + (byteData[offset + 1] & 0xFF);
|
return ((byteData[offset] & 0xFF) << 8) + (byteData[offset + 1] & 0xFF);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ public abstract class ZLLanguageUtil {
|
||||||
|
|
||||||
private ZLLanguageUtil() {
|
private ZLLanguageUtil() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class CodeComparator implements Comparator<String> {
|
public static class CodeComparator implements Comparator<String> {
|
||||||
public int compare(String code0, String code1) {
|
public int compare(String code0, String code1) {
|
||||||
if (code0 == null) {
|
if (code0 == null) {
|
||||||
|
@ -85,7 +85,7 @@ public abstract class ZLLanguageUtil {
|
||||||
|
|
||||||
return Collections.unmodifiableList(ourLanguageCodes);
|
return Collections.unmodifiableList(ourLanguageCodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String languageName(String code) {
|
public static String languageName(String code) {
|
||||||
return ZLResource.resource("language").getResource(code).getValue();
|
return ZLResource.resource("language").getResource(code).getValue();
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ public abstract class ZLibrary {
|
||||||
public static ZLibrary Instance() {
|
public static ZLibrary Instance() {
|
||||||
return ourImplementation;
|
return ourImplementation;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ZLibrary ourImplementation;
|
private static ZLibrary ourImplementation;
|
||||||
|
|
||||||
public static final String SCREEN_ORIENTATION_SYSTEM = "system";
|
public static final String SCREEN_ORIENTATION_SYSTEM = "system";
|
||||||
|
|
|
@ -67,7 +67,7 @@ public abstract class ZLNetworkRequest {
|
||||||
|
|
||||||
public void doBefore() throws ZLNetworkException {
|
public void doBefore() throws ZLNetworkException {
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract void handleStream(InputStream inputStream, int length) throws IOException, ZLNetworkException;
|
public abstract void handleStream(InputStream inputStream, int length) throws IOException, ZLNetworkException;
|
||||||
|
|
||||||
public void doAfter(boolean success) throws ZLNetworkException {
|
public void doAfter(boolean success) throws ZLNetworkException {
|
||||||
|
|
|
@ -23,7 +23,7 @@ import org.geometerplus.zlibrary.core.config.ZLConfig;
|
||||||
|
|
||||||
public abstract class ZLOption {
|
public abstract class ZLOption {
|
||||||
public static final String PLATFORM_GROUP = "PlatformOptions";
|
public static final String PLATFORM_GROUP = "PlatformOptions";
|
||||||
|
|
||||||
private final String myGroup;
|
private final String myGroup;
|
||||||
private final String myOptionName;
|
private final String myOptionName;
|
||||||
protected boolean myIsSynchronized;
|
protected boolean myIsSynchronized;
|
||||||
|
|
|
@ -21,7 +21,7 @@ package org.geometerplus.zlibrary.core.resources;
|
||||||
|
|
||||||
abstract public class ZLResource {
|
abstract public class ZLResource {
|
||||||
public final String Name;
|
public final String Name;
|
||||||
|
|
||||||
public static ZLResource resource(String key) {
|
public static ZLResource resource(String key) {
|
||||||
ZLTreeResource.buildTree();
|
ZLTreeResource.buildTree();
|
||||||
if (ZLTreeResource.ourRoot == null) {
|
if (ZLTreeResource.ourRoot == null) {
|
||||||
|
|
|
@ -31,11 +31,11 @@ public class Base64InputStream extends InputStream {
|
||||||
private final byte[] myBuffer = new byte[32768];
|
private final byte[] myBuffer = new byte[32768];
|
||||||
private int myBufferOffset;
|
private int myBufferOffset;
|
||||||
private int myBufferLength;
|
private int myBufferLength;
|
||||||
|
|
||||||
public Base64InputStream(InputStream stream) {
|
public Base64InputStream(InputStream stream) {
|
||||||
myBaseStream = stream;
|
myBaseStream = stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int available() throws IOException {
|
public int available() throws IOException {
|
||||||
// TODO: real value might be less than returned one
|
// TODO: real value might be less than returned one
|
||||||
|
|
|
@ -28,11 +28,11 @@ public class HexInputStream extends InputStream {
|
||||||
private final byte[] myBuffer = new byte[32768];
|
private final byte[] myBuffer = new byte[32768];
|
||||||
private int myBufferOffset;
|
private int myBufferOffset;
|
||||||
private int myBufferLength;
|
private int myBufferLength;
|
||||||
|
|
||||||
public HexInputStream(InputStream stream) {
|
public HexInputStream(InputStream stream) {
|
||||||
myBaseStream = stream;
|
myBaseStream = stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int available() throws IOException {
|
public int available() throws IOException {
|
||||||
// TODO: real value might be less than returned one
|
// TODO: real value might be less than returned one
|
||||||
|
|
|
@ -25,14 +25,14 @@ import java.io.InputStream;
|
||||||
public class SliceInputStream extends ZLInputStreamWithOffset {
|
public class SliceInputStream extends ZLInputStreamWithOffset {
|
||||||
private final int myStart;
|
private final int myStart;
|
||||||
private final int myLength;
|
private final int myLength;
|
||||||
|
|
||||||
public SliceInputStream(InputStream base, int start, int length) throws IOException {
|
public SliceInputStream(InputStream base, int start, int length) throws IOException {
|
||||||
super(base);
|
super(base);
|
||||||
super.skip(start);
|
super.skip(start);
|
||||||
myStart = start;
|
myStart = start;
|
||||||
myLength = length;
|
myLength = length;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int read() throws IOException {
|
public int read() throws IOException {
|
||||||
if (myLength >= offset()) {
|
if (myLength >= offset()) {
|
||||||
|
|
|
@ -23,7 +23,7 @@ public enum ZLBoolean3 {
|
||||||
B3_FALSE("false"),
|
B3_FALSE("false"),
|
||||||
B3_TRUE("true"),
|
B3_TRUE("true"),
|
||||||
B3_UNDEFINED("undefined");
|
B3_UNDEFINED("undefined");
|
||||||
|
|
||||||
public final String Name;
|
public final String Name;
|
||||||
|
|
||||||
private ZLBoolean3(String name) {
|
private ZLBoolean3(String name) {
|
||||||
|
|
|
@ -27,25 +27,25 @@ public final class ZLColor {
|
||||||
public final short Red;
|
public final short Red;
|
||||||
public final short Green;
|
public final short Green;
|
||||||
public final short Blue;
|
public final short Blue;
|
||||||
|
|
||||||
public ZLColor(int r, int g, int b) {
|
public ZLColor(int r, int g, int b) {
|
||||||
Red = (short)(r & 0xFF);
|
Red = (short)(r & 0xFF);
|
||||||
Green = (short)(g & 0xFF);
|
Green = (short)(g & 0xFF);
|
||||||
Blue = (short)(b & 0xFF);
|
Blue = (short)(b & 0xFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ZLColor(int intValue) {
|
public ZLColor(int intValue) {
|
||||||
Red = (short)((intValue >> 16) & 0xFF);
|
Red = (short)((intValue >> 16) & 0xFF);
|
||||||
Green = (short)((intValue >> 8) & 0xFF);
|
Green = (short)((intValue >> 8) & 0xFF);
|
||||||
Blue = (short)(intValue & 0xFF);
|
Blue = (short)(intValue & 0xFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getIntValue() {
|
public int getIntValue() {
|
||||||
return (Red << 16) + (Green << 8) + Blue;
|
return (Red << 16) + (Green << 8) + Blue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (o == this) {
|
if (o == this) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,11 +25,11 @@ import java.io.InputStream;
|
||||||
public class ZLInputStreamWithOffset extends InputStream {
|
public class ZLInputStreamWithOffset extends InputStream {
|
||||||
private final InputStream myDecoratedStream;
|
private final InputStream myDecoratedStream;
|
||||||
private int myOffset = 0;
|
private int myOffset = 0;
|
||||||
|
|
||||||
public ZLInputStreamWithOffset(InputStream stream) {
|
public ZLInputStreamWithOffset(InputStream stream) {
|
||||||
myDecoratedStream = stream;
|
myDecoratedStream = stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int available() throws IOException {
|
public int available() throws IOException {
|
||||||
return myDecoratedStream.available();
|
return myDecoratedStream.available();
|
||||||
|
|
|
@ -71,5 +71,5 @@ public abstract class ZLSearchUtil {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@ public class ZLTTFInfoDetector {
|
||||||
|
|
||||||
final byte[] subtable = new byte[12];
|
final byte[] subtable = new byte[12];
|
||||||
myPosition += myStream.read(subtable);
|
myPosition += myStream.read(subtable);
|
||||||
|
|
||||||
final int numTables = getInt16(subtable, 4);
|
final int numTables = getInt16(subtable, 4);
|
||||||
final byte[] tables = new byte[16 * numTables];
|
final byte[] tables = new byte[16 * numTables];
|
||||||
myPosition += myStream.read(tables);
|
myPosition += myStream.read(tables);
|
||||||
|
@ -157,7 +157,7 @@ public class ZLTTFInfoDetector {
|
||||||
buffer = readTable(nameInfo);
|
buffer = readTable(nameInfo);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (getInt16(buffer, 0) != 0) {
|
if (getInt16(buffer, 0) != 0) {
|
||||||
throw new IOException("Name table format is invalid");
|
throw new IOException("Name table format is invalid");
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,7 @@ final class DummyPaintContext extends ZLPaintContext {
|
||||||
public int getHeight() {
|
public int getHeight() {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getStringWidth(char[] string, int offset, int length) {
|
public int getStringWidth(char[] string, int offset, int length) {
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -94,7 +94,7 @@ abstract public class ZLPaintContext {
|
||||||
|
|
||||||
abstract public int getWidth();
|
abstract public int getWidth();
|
||||||
abstract public int getHeight();
|
abstract public int getHeight();
|
||||||
|
|
||||||
public final int getStringWidth(String string) {
|
public final int getStringWidth(String string) {
|
||||||
return getStringWidth(string.toCharArray(), 0, string.length());
|
return getStringWidth(string.toCharArray(), 0, string.length());
|
||||||
}
|
}
|
||||||
|
|
|
@ -185,7 +185,7 @@ final class ZLXMLParser {
|
||||||
return value;
|
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[]>>();
|
new HashMap<List<String>,HashMap<String,char[]>>();
|
||||||
|
|
||||||
static synchronized HashMap<String,char[]> getDTDMap(List<String> dtdList) throws IOException {
|
static synchronized HashMap<String,char[]> getDTDMap(List<String> dtdList) throws IOException {
|
||||||
|
|
|
@ -35,7 +35,7 @@ public abstract class ZLXMLReaderAdapter implements ZLXMLReader {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean readQuietly(String string) {
|
public boolean readQuietly(String string) {
|
||||||
try {
|
try {
|
||||||
read(string);
|
read(string);
|
||||||
|
@ -44,11 +44,11 @@ public abstract class ZLXMLReaderAdapter implements ZLXMLReader {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void read(ZLFile file) throws IOException {
|
public void read(ZLFile file) throws IOException {
|
||||||
ZLXMLProcessor.read(this, file);
|
ZLXMLProcessor.read(this, file);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void read(InputStream stream) throws IOException {
|
public void read(InputStream stream) throws IOException {
|
||||||
ZLXMLProcessor.read(this, stream, 65536);
|
ZLXMLProcessor.read(this, stream, 65536);
|
||||||
}
|
}
|
||||||
|
@ -68,21 +68,21 @@ public abstract class ZLXMLReaderAdapter implements ZLXMLReader {
|
||||||
public boolean startElementHandler(String tag, ZLStringMap attributes) {
|
public boolean startElementHandler(String tag, ZLStringMap attributes) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean endElementHandler(String tag) {
|
public boolean endElementHandler(String tag) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void characterDataHandler(char[] ch, int start, int length) {
|
public void characterDataHandler(char[] ch, int start, int length) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void characterDataHandlerFinal(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 startDocumentHandler() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void endDocumentHandler() {
|
public void endDocumentHandler() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,11 +22,11 @@ package org.geometerplus.zlibrary.text.hyphenation;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.geometerplus.zlibrary.core.util.*;
|
import org.geometerplus.zlibrary.core.util.*;
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.text.view.ZLTextWord;
|
import org.geometerplus.zlibrary.text.view.ZLTextWord;
|
||||||
|
|
||||||
public abstract class ZLTextHyphenator {
|
public abstract class ZLTextHyphenator {
|
||||||
private static ZLTextHyphenator ourInstance;
|
private static ZLTextHyphenator ourInstance;
|
||||||
|
|
||||||
public static ZLTextHyphenator Instance() {
|
public static ZLTextHyphenator Instance() {
|
||||||
if (ourInstance == null) {
|
if (ourInstance == null) {
|
||||||
ourInstance = new ZLTextTeXHyphenator();
|
ourInstance = new ZLTextTeXHyphenator();
|
||||||
|
@ -78,16 +78,16 @@ public abstract class ZLTextHyphenator {
|
||||||
break;
|
break;
|
||||||
case '-':
|
case '-':
|
||||||
mask[i] = (i >= 3)
|
mask[i] = (i >= 3)
|
||||||
&& isLetter[i - 3]
|
&& isLetter[i - 3]
|
||||||
&& isLetter[i - 2]
|
&& isLetter[i - 2]
|
||||||
&& isLetter[i]
|
&& isLetter[i]
|
||||||
&& isLetter[i + 1];
|
&& isLetter[i + 1];
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
mask[i] = mask[i]
|
mask[i] = mask[i]
|
||||||
&& isLetter[i - 2]
|
&& isLetter[i - 2]
|
||||||
&& isLetter[i - 1]
|
&& isLetter[i - 1]
|
||||||
&& isLetter[i]
|
&& isLetter[i]
|
||||||
&& isLetter[i + 1];
|
&& isLetter[i + 1];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,7 +100,7 @@ final class ZLTextTeXHyphenator extends ZLTextHyphenator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < length - 1; i++) {
|
for (int i = 0; i < length - 1; i++) {
|
||||||
mask[i] = (values[i + 1] % 2) == 1;
|
mask[i] = (values[i + 1] % 2) == 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ public final class ZLImageEntry {
|
||||||
VOffset = vOffset;
|
VOffset = vOffset;
|
||||||
IsCover = isCover;
|
IsCover = isCover;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ZLImage getImage() {
|
public ZLImage getImage() {
|
||||||
return myImageMap.get(Id);
|
return myImageMap.get(Id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,6 @@ public interface ZLTextModel {
|
||||||
// text length for paragraphs from 0 to index
|
// text length for paragraphs from 0 to index
|
||||||
int getTextLength(int index);
|
int getTextLength(int index);
|
||||||
int findParagraphByTextLength(int length);
|
int findParagraphByTextLength(int length);
|
||||||
|
|
||||||
int search(final String text, int startIndex, int endIndex, boolean ignoreCase);
|
int search(final String text, int startIndex, int endIndex, boolean ignoreCase);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ package org.geometerplus.zlibrary.text.model;
|
||||||
class ZLTextParagraphImpl implements ZLTextParagraph {
|
class ZLTextParagraphImpl implements ZLTextParagraph {
|
||||||
private final ZLTextPlainModel myModel;
|
private final ZLTextPlainModel myModel;
|
||||||
private final int myIndex;
|
private final int myIndex;
|
||||||
|
|
||||||
ZLTextParagraphImpl(ZLTextPlainModel model, int index) {
|
ZLTextParagraphImpl(ZLTextPlainModel model, int index) {
|
||||||
myModel = model;
|
myModel = model;
|
||||||
myIndex = index;
|
myIndex = index;
|
||||||
|
|
|
@ -126,7 +126,7 @@ public abstract class ZLTextStyleEntry {
|
||||||
myFeatureMask |= 1 << Feature.ALIGNMENT_TYPE;
|
myFeatureMask |= 1 << Feature.ALIGNMENT_TYPE;
|
||||||
myAlignmentType = alignmentType;
|
myAlignmentType = alignmentType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final byte getAlignmentType() {
|
public final byte getAlignmentType() {
|
||||||
return myAlignmentType;
|
return myAlignmentType;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ public final class ZLTextRegion {
|
||||||
final boolean accepts(ZLTextElementArea area) {
|
final boolean accepts(ZLTextElementArea area) {
|
||||||
return compareTo(area) == 0;
|
return compareTo(area) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final boolean equals(Object other) {
|
public final boolean equals(Object other) {
|
||||||
if (other == this) {
|
if (other == this) {
|
||||||
|
|
|
@ -293,7 +293,7 @@ public abstract class ZLTextView extends ZLTextViewBase {
|
||||||
return mySelection.getCursorInMovementPoint();
|
return mySelection.getCursorInMovementPoint();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cursor == ZLTextSelectionCursor.Left) {
|
if (cursor == ZLTextSelectionCursor.Left) {
|
||||||
if (mySelection.hasAPartBeforePage(page)) {
|
if (mySelection.hasAPartBeforePage(page)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -172,8 +172,8 @@ abstract class ZLTextViewBase extends ZLView {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final ZLPaintContext.ScalingType getScalingType(ZLTextImageElement imageElement) {
|
protected final ZLPaintContext.ScalingType getScalingType(ZLTextImageElement imageElement) {
|
||||||
switch (getImageFitting()) {
|
switch (getImageFitting()) {
|
||||||
default:
|
default:
|
||||||
case none:
|
case none:
|
||||||
return ZLPaintContext.ScalingType.IntegerCoefficient;
|
return ZLPaintContext.ScalingType.IntegerCoefficient;
|
||||||
case covers:
|
case covers:
|
||||||
|
|
|
@ -21,7 +21,7 @@ package org.geometerplus.zlibrary.text.view;
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.core.view.ZLPaintContext;
|
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 char[] Data;
|
||||||
public final int Offset;
|
public final int Offset;
|
||||||
public final int Length;
|
public final int Length;
|
||||||
|
@ -48,7 +48,7 @@ public final class ZLTextWord extends ZLTextElement {
|
||||||
myNext = mark;
|
myNext = mark;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ZLTextWord(char[] data, int offset, int length, int paragraphOffset) {
|
public ZLTextWord(char[] data, int offset, int length, int paragraphOffset) {
|
||||||
Data = data;
|
Data = data;
|
||||||
Offset = offset;
|
Offset = offset;
|
||||||
|
@ -72,7 +72,7 @@ public final class ZLTextWord extends ZLTextElement {
|
||||||
public int getParagraphOffset() {
|
public int getParagraphOffset() {
|
||||||
return myParagraphOffset;
|
return myParagraphOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addMark(int start, int length) {
|
public void addMark(int start, int length) {
|
||||||
Mark existingMark = myMark;
|
Mark existingMark = myMark;
|
||||||
Mark mark = new Mark(start, length);
|
Mark mark = new Mark(start, length);
|
||||||
|
@ -85,13 +85,13 @@ public final class ZLTextWord extends ZLTextElement {
|
||||||
}
|
}
|
||||||
mark.setNext(existingMark.getNext());
|
mark.setNext(existingMark.getNext());
|
||||||
existingMark.setNext(mark);
|
existingMark.setNext(mark);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getWidth(ZLPaintContext context) {
|
public int getWidth(ZLPaintContext context) {
|
||||||
int width = myWidth;
|
int width = myWidth;
|
||||||
if (width <= 1) {
|
if (width <= 1) {
|
||||||
width = context.getStringWidth(Data, Offset, Length);
|
width = context.getStringWidth(Data, Offset, Length);
|
||||||
myWidth = width;
|
myWidth = width;
|
||||||
}
|
}
|
||||||
return width;
|
return width;
|
||||||
|
|
|
@ -26,7 +26,7 @@ public final class ZLTextWordCursor extends ZLTextPosition {
|
||||||
private ZLTextParagraphCursor myParagraphCursor;
|
private ZLTextParagraphCursor myParagraphCursor;
|
||||||
private int myElementIndex;
|
private int myElementIndex;
|
||||||
private int myCharIndex;
|
private int myCharIndex;
|
||||||
|
|
||||||
// private int myModelIndex;
|
// private int myModelIndex;
|
||||||
|
|
||||||
public ZLTextWordCursor() {
|
public ZLTextWordCursor() {
|
||||||
|
@ -112,7 +112,7 @@ public final class ZLTextWordCursor extends ZLTextPosition {
|
||||||
}
|
}
|
||||||
return new ZLTextMark(paragraph.Index + 1, 0, 0);
|
return new ZLTextMark(paragraph.Index + 1, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void nextWord() {
|
public void nextWord() {
|
||||||
myElementIndex++;
|
myElementIndex++;
|
||||||
myCharIndex = 0;
|
myCharIndex = 0;
|
||||||
|
@ -165,7 +165,7 @@ public final class ZLTextWordCursor extends ZLTextPosition {
|
||||||
paragraphIndex = Math.max(0, Math.min(paragraphIndex, model.getParagraphsNumber() - 1));
|
paragraphIndex = Math.max(0, Math.min(paragraphIndex, model.getParagraphsNumber() - 1));
|
||||||
myParagraphCursor = ZLTextParagraphCursor.cursor(model, paragraphIndex);
|
myParagraphCursor = ZLTextParagraphCursor.cursor(model, paragraphIndex);
|
||||||
moveToParagraphStart();
|
moveToParagraphStart();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void moveTo(int wordIndex, int charIndex) {
|
public void moveTo(int wordIndex, int charIndex) {
|
||||||
|
@ -198,7 +198,7 @@ public final class ZLTextWordCursor extends ZLTextPosition {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reset() {
|
public void reset() {
|
||||||
myParagraphCursor = null;
|
myParagraphCursor = null;
|
||||||
|
|
|
@ -56,7 +56,7 @@ public class ZLTextBaseStyle extends ZLTextStyle {
|
||||||
fontSize = fontSize * ZLibrary.Instance().getDisplayDPI() / 320 * 2;
|
fontSize = fontSize * ZLibrary.Instance().getDisplayDPI() / 320 * 2;
|
||||||
FontSizeOption = new ZLIntegerRangeOption(GROUP, "Base:fontSize", 5, Math.max(72, fontSize * 2), fontSize);
|
FontSizeOption = new ZLIntegerRangeOption(GROUP, "Base:fontSize", 5, Math.max(72, fontSize * 2), fontSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getFontFamily() {
|
public String getFontFamily() {
|
||||||
return FontFamilyOption.getValue();
|
return FontFamilyOption.getValue();
|
||||||
|
@ -105,7 +105,7 @@ public class ZLTextBaseStyle extends ZLTextStyle {
|
||||||
public int getFirstLineIndentDelta() {
|
public int getFirstLineIndentDelta() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLineSpacePercent() {
|
public int getLineSpacePercent() {
|
||||||
return LineSpaceOption.getValue() * 10;
|
return LineSpaceOption.getValue() * 10;
|
||||||
|
|
|
@ -25,10 +25,10 @@ import org.geometerplus.zlibrary.text.model.ZLTextAlignmentType;
|
||||||
|
|
||||||
public class ZLTextFullyDecoratedStyle extends ZLTextPartiallyDecoratedStyle {
|
public class ZLTextFullyDecoratedStyle extends ZLTextPartiallyDecoratedStyle {
|
||||||
private final ZLTextFullStyleDecoration myFullDecoration;
|
private final ZLTextFullStyleDecoration myFullDecoration;
|
||||||
|
|
||||||
ZLTextFullyDecoratedStyle(ZLTextStyle base, ZLTextFullStyleDecoration decoration, ZLTextHyperlink hyperlink) {
|
ZLTextFullyDecoratedStyle(ZLTextStyle base, ZLTextFullStyleDecoration decoration, ZLTextHyperlink hyperlink) {
|
||||||
super(base, decoration, hyperlink);
|
super(base, decoration, hyperlink);
|
||||||
myFullDecoration = decoration;
|
myFullDecoration = decoration;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -45,7 +45,7 @@ public class ZLTextFullyDecoratedStyle extends ZLTextPartiallyDecoratedStyle {
|
||||||
public int getFirstLineIndentDelta() {
|
public int getFirstLineIndentDelta() {
|
||||||
return (getAlignment() == ZLTextAlignmentType.ALIGN_CENTER) ? 0 : Base.getFirstLineIndentDelta() + myFullDecoration.FirstLineIndentDeltaOption.getValue();
|
return (getAlignment() == ZLTextAlignmentType.ALIGN_CENTER) ? 0 : Base.getFirstLineIndentDelta() + myFullDecoration.FirstLineIndentDeltaOption.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLineSpacePercent() {
|
public int getLineSpacePercent() {
|
||||||
int value = myFullDecoration.LineSpacePercentOption.getValue();
|
int value = myFullDecoration.LineSpacePercentOption.getValue();
|
||||||
|
@ -60,7 +60,7 @@ public class ZLTextFullyDecoratedStyle extends ZLTextPartiallyDecoratedStyle {
|
||||||
@Override
|
@Override
|
||||||
public int getSpaceAfter() {
|
public int getSpaceAfter() {
|
||||||
return myFullDecoration.SpaceAfterOption.getValue();
|
return myFullDecoration.SpaceAfterOption.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte getAlignment() {
|
public byte getAlignment() {
|
||||||
|
|
|
@ -29,7 +29,7 @@ class ZLTextPartiallyDecoratedStyle extends ZLTextDecoratedStyle {
|
||||||
|
|
||||||
ZLTextPartiallyDecoratedStyle(ZLTextStyle base, ZLTextStyleDecoration decoration, ZLTextHyperlink hyperlink) {
|
ZLTextPartiallyDecoratedStyle(ZLTextStyle base, ZLTextStyleDecoration decoration, ZLTextHyperlink hyperlink) {
|
||||||
super(base, hyperlink);
|
super(base, hyperlink);
|
||||||
myDecoration = decoration;
|
myDecoration = decoration;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -104,8 +104,8 @@ class ZLTextPartiallyDecoratedStyle extends ZLTextDecoratedStyle {
|
||||||
@Override
|
@Override
|
||||||
public int getFirstLineIndentDelta() {
|
public int getFirstLineIndentDelta() {
|
||||||
return Base.getFirstLineIndentDelta();
|
return Base.getFirstLineIndentDelta();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLineSpacePercent() {
|
public int getLineSpacePercent() {
|
||||||
return Base.getLineSpacePercent();
|
return Base.getLineSpacePercent();
|
||||||
|
@ -124,7 +124,7 @@ class ZLTextPartiallyDecoratedStyle extends ZLTextDecoratedStyle {
|
||||||
@Override
|
@Override
|
||||||
public int getSpaceAfter() {
|
public int getSpaceAfter() {
|
||||||
return Base.getSpaceAfter();
|
return Base.getSpaceAfter();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte getAlignment() {
|
public byte getAlignment() {
|
||||||
|
@ -140,6 +140,6 @@ class ZLTextPartiallyDecoratedStyle extends ZLTextDecoratedStyle {
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return Base.allowHyphenations();
|
return Base.allowHyphenations();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ public class ZLTextStyleDecoration {
|
||||||
VerticalShiftOption = new ZLIntegerOption(STYLE, name + ":vShift", verticalShift);
|
VerticalShiftOption = new ZLIntegerOption(STYLE, name + ":vShift", verticalShift);
|
||||||
AllowHyphenationsOption = new ZLBoolean3Option(STYLE, name + ":allowHyphenations", allowHyphenations);
|
AllowHyphenationsOption = new ZLBoolean3Option(STYLE, name + ":allowHyphenations", allowHyphenations);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ZLTextStyle createDecoratedStyle(ZLTextStyle base) {
|
public ZLTextStyle createDecoratedStyle(ZLTextStyle base) {
|
||||||
return createDecoratedStyle(base, null);
|
return createDecoratedStyle(base, null);
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ public class ZLTextStyleDecoration {
|
||||||
public ZLTextStyle createDecoratedStyle(ZLTextStyle base, ZLTextHyperlink hyperlink) {
|
public ZLTextStyle createDecoratedStyle(ZLTextStyle base, ZLTextHyperlink hyperlink) {
|
||||||
return new ZLTextPartiallyDecoratedStyle(base, this, hyperlink);
|
return new ZLTextPartiallyDecoratedStyle(base, this, hyperlink);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return myName;
|
return myName;
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ public final class ZLAndroidApplicationWindow extends ZLApplicationWindow {
|
||||||
final MenuItem menuItem = menu.add(name);
|
final MenuItem menuItem = menu.add(name);
|
||||||
if (iconId != null) {
|
if (iconId != null) {
|
||||||
menuItem.setIcon(iconId);
|
menuItem.setIcon(iconId);
|
||||||
final FBReader activity =
|
final FBReader activity =
|
||||||
((ZLAndroidLibrary)ZLAndroidLibrary.Instance()).getActivity();
|
((ZLAndroidLibrary)ZLAndroidLibrary.Instance()).getActivity();
|
||||||
if (showInActionBar) {
|
if (showInActionBar) {
|
||||||
menuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
|
menuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
|
||||||
|
@ -101,14 +101,14 @@ public final class ZLAndroidApplicationWindow extends ZLApplicationWindow {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final FBReader activity =
|
final FBReader activity =
|
||||||
((ZLAndroidLibrary)ZLAndroidLibrary.Instance()).getActivity();
|
((ZLAndroidLibrary)ZLAndroidLibrary.Instance()).getActivity();
|
||||||
activity.refresh();
|
activity.refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void runWithMessage(String key, Runnable action, Runnable postAction) {
|
public void runWithMessage(String key, Runnable action, Runnable postAction) {
|
||||||
final Activity activity =
|
final Activity activity =
|
||||||
((ZLAndroidLibrary)ZLAndroidLibrary.Instance()).getActivity();
|
((ZLAndroidLibrary)ZLAndroidLibrary.Instance()).getActivity();
|
||||||
if (activity != null) {
|
if (activity != null) {
|
||||||
UIUtil.runWithMessage(activity, key, action, postAction, false);
|
UIUtil.runWithMessage(activity, key, action, postAction, false);
|
||||||
|
@ -121,7 +121,7 @@ public final class ZLAndroidApplicationWindow extends ZLApplicationWindow {
|
||||||
protected void processException(Exception exception) {
|
protected void processException(Exception exception) {
|
||||||
exception.printStackTrace();
|
exception.printStackTrace();
|
||||||
|
|
||||||
final Activity activity =
|
final Activity activity =
|
||||||
((ZLAndroidLibrary)ZLAndroidLibrary.Instance()).getActivity();
|
((ZLAndroidLibrary)ZLAndroidLibrary.Instance()).getActivity();
|
||||||
final Intent intent = new Intent(
|
final Intent intent = new Intent(
|
||||||
"android.fbreader.action.ERROR",
|
"android.fbreader.action.ERROR",
|
||||||
|
@ -149,7 +149,7 @@ public final class ZLAndroidApplicationWindow extends ZLApplicationWindow {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setTitle(final String title) {
|
public void setTitle(final String title) {
|
||||||
final Activity activity =
|
final Activity activity =
|
||||||
((ZLAndroidLibrary)ZLAndroidLibrary.Instance()).getActivity();
|
((ZLAndroidLibrary)ZLAndroidLibrary.Instance()).getActivity();
|
||||||
if (activity != null) {
|
if (activity != null) {
|
||||||
activity.runOnUiThread(new Runnable() {
|
activity.runOnUiThread(new Runnable() {
|
||||||
|
|
|
@ -307,7 +307,7 @@ public final class ZLAndroidLibrary extends ZLibrary {
|
||||||
return length;
|
return length;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
return sizeSlow();
|
return sizeSlow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private long sizeSlow() {
|
private long sizeSlow() {
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue