mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-04 02:09:35 +02:00
Eclipse code cleanup
git-svn-id: https://only.mawhrin.net/repos/FBReaderJ/trunk@1507 6a642e6f-84f6-412e-ac94-c4a38d5a04b0
This commit is contained in:
parent
fc1a273ceb
commit
2f4fcff738
122 changed files with 259 additions and 394 deletions
|
@ -1,9 +1,6 @@
|
||||||
package org.amse.ys.zip;
|
package org.amse.ys.zip;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
|
|
||||||
class ZipInputStream extends InputStream {
|
class ZipInputStream extends InputStream {
|
||||||
private final ZipFile myParent;
|
private final ZipFile myParent;
|
||||||
|
|
|
@ -25,7 +25,6 @@ import android.view.*;
|
||||||
import android.widget.*;
|
import android.widget.*;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.ui.android.R;
|
|
||||||
|
|
||||||
class SimpleContainer extends ViewGroup {
|
class SimpleContainer extends ViewGroup {
|
||||||
private final View myEditText;
|
private final View myEditText;
|
||||||
|
|
|
@ -26,14 +26,12 @@ import android.view.*;
|
||||||
import android.widget.*;
|
import android.widget.*;
|
||||||
import android.content.*;
|
import android.content.*;
|
||||||
import android.app.TabActivity;
|
import android.app.TabActivity;
|
||||||
import android.graphics.drawable.Drawable;
|
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.core.resources.ZLResource;
|
import org.geometerplus.zlibrary.core.resources.ZLResource;
|
||||||
import org.geometerplus.zlibrary.text.view.*;
|
import org.geometerplus.zlibrary.text.view.*;
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.ui.android.R;
|
import org.geometerplus.zlibrary.ui.android.R;
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.core.resources.ZLResource;
|
|
||||||
import org.geometerplus.fbreader.fbreader.FBReader;
|
import org.geometerplus.fbreader.fbreader.FBReader;
|
||||||
import org.geometerplus.fbreader.library.*;
|
import org.geometerplus.fbreader.library.*;
|
||||||
|
|
||||||
|
@ -45,8 +43,8 @@ public class BookmarksActivity extends TabActivity implements MenuItem.OnMenuIte
|
||||||
private static final int DELETE_ITEM_ID = 2;
|
private static final int DELETE_ITEM_ID = 2;
|
||||||
|
|
||||||
List<Bookmark> AllBooksBookmarks;
|
List<Bookmark> AllBooksBookmarks;
|
||||||
private final List<Bookmark> myThisBookBookmarks = new LinkedList();
|
private final List<Bookmark> myThisBookBookmarks = new LinkedList<Bookmark>();
|
||||||
private final List<Bookmark> mySearchResults = new LinkedList();
|
private final List<Bookmark> mySearchResults = new LinkedList<Bookmark>();
|
||||||
|
|
||||||
private ListView myThisBookView;
|
private ListView myThisBookView;
|
||||||
private ListView myAllBooksView;
|
private ListView myAllBooksView;
|
||||||
|
@ -396,7 +394,7 @@ mainLoop:
|
||||||
return myCurrentBook ? myBookmarks.size() + 1 : myBookmarks.size();
|
return myCurrentBook ? myBookmarks.size() + 1 : myBookmarks.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void onItemClick(AdapterView parent, View view, int position, long id) {
|
public final void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||||
final Bookmark bookmark = getItem(position);
|
final Bookmark bookmark = getItem(position);
|
||||||
if (bookmark != null) {
|
if (bookmark != null) {
|
||||||
gotoBookmark(bookmark);
|
gotoBookmark(bookmark);
|
||||||
|
|
|
@ -27,7 +27,6 @@ import android.content.DialogInterface;
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.ui.android.R;
|
import org.geometerplus.zlibrary.ui.android.R;
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.core.filesystem.*;
|
|
||||||
import org.geometerplus.zlibrary.core.tree.ZLTree;
|
import org.geometerplus.zlibrary.core.tree.ZLTree;
|
||||||
import org.geometerplus.zlibrary.core.options.ZLStringOption;
|
import org.geometerplus.zlibrary.core.options.ZLStringOption;
|
||||||
import org.geometerplus.zlibrary.core.resources.ZLResource;
|
import org.geometerplus.zlibrary.core.resources.ZLResource;
|
||||||
|
@ -180,7 +179,7 @@ public class LibraryTabActivity extends TabActivity implements MenuItem.OnMenuIt
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private ZLTree findFirstSelectedItem() {
|
private ZLTree<?> findFirstSelectedItem() {
|
||||||
if (myCurrentBook == null) {
|
if (myCurrentBook == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -228,7 +227,8 @@ public class LibraryTabActivity extends TabActivity implements MenuItem.OnMenuIt
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean runTreeItem(ZLTree tree) {
|
@Override
|
||||||
|
protected boolean runTreeItem(ZLTree<?> tree) {
|
||||||
if (super.runTreeItem(tree)) {
|
if (super.runTreeItem(tree)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,6 @@ import android.content.Intent;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.core.resources.ZLResource;
|
import org.geometerplus.zlibrary.core.resources.ZLResource;
|
||||||
import org.geometerplus.zlibrary.core.dialogs.ZLDialogManager;
|
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.ui.android.dialogs.ZLAndroidDialogManager;
|
import org.geometerplus.zlibrary.ui.android.dialogs.ZLAndroidDialogManager;
|
||||||
|
|
||||||
|
|
|
@ -22,10 +22,7 @@ package org.geometerplus.android.fbreader;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.*;
|
import android.view.*;
|
||||||
import android.widget.*;
|
import android.widget.*;
|
||||||
import android.content.Context;
|
|
||||||
import android.app.ListActivity;
|
import android.app.ListActivity;
|
||||||
import android.content.res.TypedArray;
|
|
||||||
import android.graphics.drawable.Drawable;
|
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.core.application.ZLApplication;
|
import org.geometerplus.zlibrary.core.application.ZLApplication;
|
||||||
import org.geometerplus.zlibrary.core.resources.ZLResource;
|
import org.geometerplus.zlibrary.core.resources.ZLResource;
|
||||||
|
@ -39,7 +36,7 @@ import org.geometerplus.fbreader.fbreader.FBReader;
|
||||||
|
|
||||||
public class TOCActivity extends ListActivity {
|
public class TOCActivity extends ListActivity {
|
||||||
private TOCAdapter myAdapter;
|
private TOCAdapter myAdapter;
|
||||||
private ZLTree mySelectedItem;
|
private ZLTree<?> mySelectedItem;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle bundle) {
|
public void onCreate(Bundle bundle) {
|
||||||
|
@ -92,11 +89,9 @@ public class TOCActivity extends ListActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
private final class TOCAdapter extends ZLTreeAdapter {
|
private final class TOCAdapter extends ZLTreeAdapter {
|
||||||
private final TOCTree myRoot;
|
|
||||||
|
|
||||||
TOCAdapter(TOCTree root) {
|
TOCAdapter(TOCTree root) {
|
||||||
super(getListView(), root);
|
super(getListView(), root);
|
||||||
myRoot = root;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -133,7 +128,7 @@ public class TOCActivity extends ListActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean runTreeItem(ZLTree tree) {
|
protected boolean runTreeItem(ZLTree<?> tree) {
|
||||||
if (super.runTreeItem(tree)) {
|
if (super.runTreeItem(tree)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,10 +21,8 @@ package org.geometerplus.android.fbreader;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.view.*;
|
import android.view.*;
|
||||||
import android.widget.*;
|
import android.widget.*;
|
||||||
import android.graphics.Bitmap;
|
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.core.tree.ZLTree;
|
import org.geometerplus.zlibrary.core.tree.ZLTree;
|
||||||
|
|
||||||
|
@ -32,11 +30,11 @@ import org.geometerplus.zlibrary.ui.android.R;
|
||||||
|
|
||||||
abstract class ZLTreeAdapter extends BaseAdapter implements AdapterView.OnItemClickListener, View.OnCreateContextMenuListener {
|
abstract class ZLTreeAdapter extends BaseAdapter implements AdapterView.OnItemClickListener, View.OnCreateContextMenuListener {
|
||||||
private final ListView myParent;
|
private final ListView myParent;
|
||||||
private ZLTree myTree;
|
private ZLTree<?> myTree;
|
||||||
private ZLTree[] myItems;
|
private ZLTree<?>[] myItems;
|
||||||
private final HashSet<ZLTree> myOpenItems = new HashSet<ZLTree>();
|
private final HashSet<ZLTree<?>> myOpenItems = new HashSet<ZLTree<?>>();
|
||||||
|
|
||||||
protected ZLTreeAdapter(ListView parent, ZLTree tree) {
|
protected ZLTreeAdapter(ListView parent, ZLTree<?> tree) {
|
||||||
myParent = parent;
|
myParent = parent;
|
||||||
myTree = tree;
|
myTree = tree;
|
||||||
myItems = new ZLTree[tree.getSize() - 1];
|
myItems = new ZLTree[tree.getSize() - 1];
|
||||||
|
@ -47,7 +45,7 @@ abstract class ZLTreeAdapter extends BaseAdapter implements AdapterView.OnItemCl
|
||||||
parent.setOnCreateContextMenuListener(this);
|
parent.setOnCreateContextMenuListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final void openTree(ZLTree tree) {
|
protected final void openTree(ZLTree<?> tree) {
|
||||||
if (tree == null) {
|
if (tree == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -57,7 +55,7 @@ abstract class ZLTreeAdapter extends BaseAdapter implements AdapterView.OnItemCl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void expandOrCollapseTree(ZLTree tree) {
|
public final void expandOrCollapseTree(ZLTree<?> tree) {
|
||||||
if (!tree.hasChildren()) {
|
if (!tree.hasChildren()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -71,11 +69,11 @@ abstract class ZLTreeAdapter extends BaseAdapter implements AdapterView.OnItemCl
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
public final boolean isOpen(ZLTree tree) {
|
public final boolean isOpen(ZLTree<?> tree) {
|
||||||
return myOpenItems.contains(tree);
|
return myOpenItems.contains(tree);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void selectItem(ZLTree tree) {
|
public final void selectItem(ZLTree<?> tree) {
|
||||||
if (tree == null) {
|
if (tree == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -86,7 +84,7 @@ abstract class ZLTreeAdapter extends BaseAdapter implements AdapterView.OnItemCl
|
||||||
if (parent == null) {
|
if (parent == null) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
for (ZLTree sibling : parent.subTrees()) {
|
for (ZLTree<?> sibling : parent.subTrees()) {
|
||||||
if (sibling == tree) {
|
if (sibling == tree) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -103,7 +101,7 @@ abstract class ZLTreeAdapter extends BaseAdapter implements AdapterView.OnItemCl
|
||||||
private int getCount(ZLTree<?> tree) {
|
private int getCount(ZLTree<?> tree) {
|
||||||
int count = 1;
|
int count = 1;
|
||||||
if (isOpen(tree)) {
|
if (isOpen(tree)) {
|
||||||
for (ZLTree subtree : tree.subTrees()) {
|
for (ZLTree<?> subtree : tree.subTrees()) {
|
||||||
count += getCount(subtree);
|
count += getCount(subtree);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -120,7 +118,7 @@ abstract class ZLTreeAdapter extends BaseAdapter implements AdapterView.OnItemCl
|
||||||
}
|
}
|
||||||
--position;
|
--position;
|
||||||
int index = 1;
|
int index = 1;
|
||||||
for (ZLTree subtree : tree.subTrees()) {
|
for (ZLTree<?> subtree : tree.subTrees()) {
|
||||||
int count = getCount(subtree);
|
int count = getCount(subtree);
|
||||||
if (count <= position) {
|
if (count <= position) {
|
||||||
position -= count;
|
position -= count;
|
||||||
|
@ -132,9 +130,9 @@ abstract class ZLTreeAdapter extends BaseAdapter implements AdapterView.OnItemCl
|
||||||
throw new RuntimeException("That's impossible!!!");
|
throw new RuntimeException("That's impossible!!!");
|
||||||
}
|
}
|
||||||
|
|
||||||
public final ZLTree getItem(int position) {
|
public final ZLTree<?> getItem(int position) {
|
||||||
final int index = indexByPosition(position + 1, myTree) - 1;
|
final int index = indexByPosition(position + 1, myTree) - 1;
|
||||||
ZLTree item = myItems[index];
|
ZLTree<?> item = myItems[index];
|
||||||
if (item == null) {
|
if (item == null) {
|
||||||
item = myTree.getTreeByParagraphNumber(index + 1);
|
item = myTree.getTreeByParagraphNumber(index + 1);
|
||||||
myItems[index] = item;
|
myItems[index] = item;
|
||||||
|
@ -154,7 +152,7 @@ abstract class ZLTreeAdapter extends BaseAdapter implements AdapterView.OnItemCl
|
||||||
return indexByPosition(position + 1, myTree);
|
return indexByPosition(position + 1, myTree);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean runTreeItem(ZLTree tree) {
|
protected boolean runTreeItem(ZLTree<?> tree) {
|
||||||
if (!tree.hasChildren()) {
|
if (!tree.hasChildren()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -162,7 +160,7 @@ abstract class ZLTreeAdapter extends BaseAdapter implements AdapterView.OnItemCl
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void resetTree(ZLTree tree) {
|
protected void resetTree(ZLTree<?> tree) {
|
||||||
myTree = tree;
|
myTree = tree;
|
||||||
myItems = new ZLTree[tree.getSize() - 1];
|
myItems = new ZLTree[tree.getSize() - 1];
|
||||||
myOpenItems.clear();
|
myOpenItems.clear();
|
||||||
|
@ -179,7 +177,7 @@ abstract class ZLTreeAdapter extends BaseAdapter implements AdapterView.OnItemCl
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void onItemClick(AdapterView parent, View view, int position, long id) {
|
public final void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||||
runTreeItem(getItem(position));
|
runTreeItem(getItem(position));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,7 +186,7 @@ abstract class ZLTreeAdapter extends BaseAdapter implements AdapterView.OnItemCl
|
||||||
|
|
||||||
public abstract View getView(int position, View convertView, ViewGroup parent);
|
public abstract View getView(int position, View convertView, ViewGroup parent);
|
||||||
|
|
||||||
protected final void setIcon(ImageView imageView, ZLTree tree) {
|
protected final void setIcon(ImageView imageView, ZLTree<?> tree) {
|
||||||
if (tree.hasChildren()) {
|
if (tree.hasChildren()) {
|
||||||
if (isOpen(tree)) {
|
if (isOpen(tree)) {
|
||||||
imageView.setImageResource(R.drawable.ic_list_group_open);
|
imageView.setImageResource(R.drawable.ic_list_group_open);
|
||||||
|
|
|
@ -209,7 +209,7 @@ abstract class NetworkBaseActivity extends ListActivity
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (confirm != null) {
|
if (confirm != null) {
|
||||||
final ZLResource resource = myResource.getResource("confirmQuestions");
|
//final ZLResource resource = myResource.getResource("confirmQuestions");
|
||||||
final ZLResource buttonResource = ZLResource.resource("dialog").getResource("button");
|
final ZLResource buttonResource = ZLResource.resource("dialog").getResource("button");
|
||||||
new AlertDialog.Builder(this)
|
new AlertDialog.Builder(this)
|
||||||
.setTitle(networkTree.getName())
|
.setTitle(networkTree.getName())
|
||||||
|
|
|
@ -40,7 +40,6 @@ class RefillAccountActions extends NetworkTreeActions {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void buildContextMenu(NetworkBaseActivity activity, ContextMenu menu, NetworkTree tree) {
|
public void buildContextMenu(NetworkBaseActivity activity, ContextMenu menu, NetworkTree tree) {
|
||||||
final RefillAccountTree refillTree = (RefillAccountTree) tree;
|
|
||||||
menu.setHeaderTitle(getTitleValue("refillTitle"));
|
menu.setHeaderTitle(getTitleValue("refillTitle"));
|
||||||
|
|
||||||
addMenuItem(menu, REFILL_ITEM_ID, "refillTitle");
|
addMenuItem(menu, REFILL_ITEM_ID, "refillTitle");
|
||||||
|
|
|
@ -165,8 +165,6 @@ class RegisterUserDialog extends NetworkDialog {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void prepareDialog(Dialog dialog) {
|
public void prepareDialog(Dialog dialog) {
|
||||||
final NetworkAuthenticationManager mgr = myLink.authenticationManager();
|
|
||||||
|
|
||||||
((TextView) dialog.findViewById(R.id.network_register_login)).setText((myLogin != null) ? myLogin : "");
|
((TextView) dialog.findViewById(R.id.network_register_login)).setText((myLogin != null) ? myLogin : "");
|
||||||
((TextView) dialog.findViewById(R.id.network_register_password)).setText((myPassword != null) ? myPassword : "");
|
((TextView) dialog.findViewById(R.id.network_register_password)).setText((myPassword != null) ? myPassword : "");
|
||||||
((TextView) dialog.findViewById(R.id.network_register_confirm_password)).setText((myPassword != null) ? myPassword : "");
|
((TextView) dialog.findViewById(R.id.network_register_confirm_password)).setText((myPassword != null) ? myPassword : "");
|
||||||
|
|
|
@ -48,8 +48,6 @@ class SearchItemActions extends NetworkTreeActions {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void buildContextMenu(NetworkBaseActivity activity, ContextMenu menu, NetworkTree tree) {
|
public void buildContextMenu(NetworkBaseActivity activity, ContextMenu menu, NetworkTree tree) {
|
||||||
final SearchItemTree searchTree = (SearchItemTree) tree;
|
|
||||||
final SearchResult result = searchTree.getSearchResult();
|
|
||||||
menu.setHeaderTitle(tree.getName());
|
menu.setHeaderTitle(tree.getName());
|
||||||
|
|
||||||
final boolean isLoading = NetworkView.Instance().containsItemsLoadingRunnable(NetworkSearchActivity.SEARCH_RUNNABLE_KEY);
|
final boolean isLoading = NetworkView.Instance().containsItemsLoadingRunnable(NetworkSearchActivity.SEARCH_RUNNABLE_KEY);
|
||||||
|
|
|
@ -19,8 +19,6 @@
|
||||||
|
|
||||||
package org.geometerplus.android.fbreader.preferences;
|
package org.geometerplus.android.fbreader.preferences;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.core.resources.ZLResource;
|
import org.geometerplus.zlibrary.core.resources.ZLResource;
|
||||||
|
@ -35,7 +33,7 @@ public class PreferenceActivity extends ZLPreferenceActivity {
|
||||||
super("Preferences");
|
super("Preferences");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final class ColorProfilePreference extends ZLSimplePreference {
|
/*private static final class ColorProfilePreference extends ZLSimplePreference {
|
||||||
private final FBReader myFBReader;
|
private final FBReader myFBReader;
|
||||||
private final Screen myScreen;
|
private final Screen myScreen;
|
||||||
private final String myKey;
|
private final String myKey;
|
||||||
|
@ -63,7 +61,7 @@ public class PreferenceActivity extends ZLPreferenceActivity {
|
||||||
myFBReader.setColorProfileName(myKey);
|
myFBReader.setColorProfileName(myKey);
|
||||||
myScreen.close();
|
myScreen.close();
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void init() {
|
protected void init() {
|
||||||
|
|
|
@ -19,8 +19,6 @@
|
||||||
|
|
||||||
package org.geometerplus.android.fbreader.preferences;
|
package org.geometerplus.android.fbreader.preferences;
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.core.resources.ZLResource;
|
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.preference.Preference;
|
import android.preference.Preference;
|
||||||
|
|
||||||
|
|
|
@ -20,9 +20,7 @@
|
||||||
package org.geometerplus.fbreader.bookmodel;
|
package org.geometerplus.fbreader.bookmodel;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
//import java.io.*;
|
|
||||||
import org.geometerplus.zlibrary.core.util.*;
|
|
||||||
import org.geometerplus.zlibrary.core.filesystem.ZLFile;
|
|
||||||
import org.geometerplus.zlibrary.core.image.*;
|
import org.geometerplus.zlibrary.core.image.*;
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.text.model.*;
|
import org.geometerplus.zlibrary.text.model.*;
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
|
|
||||||
package org.geometerplus.fbreader.bookmodel;
|
package org.geometerplus.fbreader.bookmodel;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
import org.geometerplus.zlibrary.core.util.*;
|
import org.geometerplus.zlibrary.core.util.*;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
|
|
@ -19,8 +19,6 @@
|
||||||
|
|
||||||
package org.geometerplus.fbreader.fbreader;
|
package org.geometerplus.fbreader.fbreader;
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.text.view.ZLTextView;
|
|
||||||
|
|
||||||
class ClearFindResultsAction extends FBAction {
|
class ClearFindResultsAction extends FBAction {
|
||||||
ClearFindResultsAction(FBReader fbreader) {
|
ClearFindResultsAction(FBReader fbreader) {
|
||||||
super(fbreader);
|
super(fbreader);
|
||||||
|
|
|
@ -19,14 +19,9 @@
|
||||||
|
|
||||||
package org.geometerplus.fbreader.fbreader;
|
package org.geometerplus.fbreader.fbreader;
|
||||||
|
|
||||||
import java.io.*;
|
|
||||||
import java.util.*;
|
|
||||||
import org.geometerplus.zlibrary.core.util.*;
|
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.core.filesystem.*;
|
import org.geometerplus.zlibrary.core.filesystem.*;
|
||||||
import org.geometerplus.zlibrary.core.application.*;
|
import org.geometerplus.zlibrary.core.application.*;
|
||||||
import org.geometerplus.zlibrary.core.dialogs.ZLDialogManager;
|
import org.geometerplus.zlibrary.core.dialogs.ZLDialogManager;
|
||||||
import org.geometerplus.zlibrary.core.library.ZLibrary;
|
|
||||||
import org.geometerplus.zlibrary.core.options.*;
|
import org.geometerplus.zlibrary.core.options.*;
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.text.hyphenation.ZLTextHyphenator;
|
import org.geometerplus.zlibrary.text.hyphenation.ZLTextHyphenator;
|
||||||
|
|
|
@ -25,7 +25,6 @@ import org.geometerplus.zlibrary.core.library.ZLibrary;
|
||||||
import org.geometerplus.zlibrary.text.model.ZLTextModel;
|
import org.geometerplus.zlibrary.text.model.ZLTextModel;
|
||||||
import org.geometerplus.zlibrary.text.view.*;
|
import org.geometerplus.zlibrary.text.view.*;
|
||||||
|
|
||||||
import org.geometerplus.fbreader.bookmodel.FBTextKind;
|
|
||||||
import org.geometerplus.fbreader.bookmodel.FBHyperlinkType;
|
import org.geometerplus.fbreader.bookmodel.FBHyperlinkType;
|
||||||
|
|
||||||
public final class FBView extends ZLTextView {
|
public final class FBView extends ZLTextView {
|
||||||
|
|
|
@ -19,8 +19,6 @@
|
||||||
|
|
||||||
package org.geometerplus.fbreader.fbreader;
|
package org.geometerplus.fbreader.fbreader;
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.core.dialogs.ZLDialogManager;
|
|
||||||
|
|
||||||
class SwitchProfileAction extends FBAction {
|
class SwitchProfileAction extends FBAction {
|
||||||
private String myProfileName;
|
private String myProfileName;
|
||||||
|
|
||||||
|
|
|
@ -19,8 +19,6 @@
|
||||||
|
|
||||||
package org.geometerplus.fbreader.fbreader;
|
package org.geometerplus.fbreader.fbreader;
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.text.view.ZLTextView;
|
|
||||||
|
|
||||||
class TrackballScrollingAction extends FBAction {
|
class TrackballScrollingAction extends FBAction {
|
||||||
private final boolean myForward;
|
private final boolean myForward;
|
||||||
|
|
||||||
|
|
|
@ -19,8 +19,6 @@
|
||||||
|
|
||||||
package org.geometerplus.fbreader.fbreader;
|
package org.geometerplus.fbreader.fbreader;
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.text.view.ZLTextView;
|
|
||||||
|
|
||||||
class VolumeKeyScrollingAction extends FBAction {
|
class VolumeKeyScrollingAction extends FBAction {
|
||||||
private final boolean myForward;
|
private final boolean myForward;
|
||||||
|
|
||||||
|
|
|
@ -19,14 +19,9 @@
|
||||||
|
|
||||||
package org.geometerplus.fbreader.formats;
|
package org.geometerplus.fbreader.formats;
|
||||||
|
|
||||||
import java.io.*;
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
import org.geometerplus.fbreader.bookmodel.BookModel;
|
import org.geometerplus.fbreader.bookmodel.BookModel;
|
||||||
import org.geometerplus.fbreader.library.Book;
|
import org.geometerplus.fbreader.library.Book;
|
||||||
import org.geometerplus.zlibrary.core.dialogs.ZLOptionsDialog;
|
|
||||||
import org.geometerplus.zlibrary.core.filesystem.ZLFile;
|
import org.geometerplus.zlibrary.core.filesystem.ZLFile;
|
||||||
import org.geometerplus.zlibrary.core.language.ZLLanguageDetector;
|
|
||||||
|
|
||||||
public abstract class FormatPlugin {
|
public abstract class FormatPlugin {
|
||||||
public abstract boolean acceptsFile(ZLFile file);
|
public abstract boolean acceptsFile(ZLFile file);
|
||||||
|
|
|
@ -25,7 +25,6 @@ import org.geometerplus.zlibrary.core.options.*;
|
||||||
import org.geometerplus.zlibrary.core.filesystem.ZLFile;
|
import org.geometerplus.zlibrary.core.filesystem.ZLFile;
|
||||||
|
|
||||||
import org.geometerplus.fbreader.formats.fb2.FB2Plugin;
|
import org.geometerplus.fbreader.formats.fb2.FB2Plugin;
|
||||||
import org.geometerplus.fbreader.formats.html.HtmlPlugin;
|
|
||||||
import org.geometerplus.fbreader.formats.oeb.OEBPlugin;
|
import org.geometerplus.fbreader.formats.oeb.OEBPlugin;
|
||||||
import org.geometerplus.fbreader.formats.pdb.MobipocketPlugin;
|
import org.geometerplus.fbreader.formats.pdb.MobipocketPlugin;
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,6 @@ package org.geometerplus.fbreader.formats.fb2;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.core.library.ZLibrary;
|
import org.geometerplus.zlibrary.core.library.ZLibrary;
|
||||||
import org.geometerplus.zlibrary.core.filesystem.ZLFile;
|
|
||||||
import org.geometerplus.fbreader.bookmodel.*;
|
import org.geometerplus.fbreader.bookmodel.*;
|
||||||
import org.geometerplus.zlibrary.core.xml.*;
|
import org.geometerplus.zlibrary.core.xml.*;
|
||||||
import org.geometerplus.zlibrary.core.util.*;
|
import org.geometerplus.zlibrary.core.util.*;
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
package org.geometerplus.fbreader.formats.fb2;
|
package org.geometerplus.fbreader.formats.fb2;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import org.geometerplus.zlibrary.core.util.*;
|
|
||||||
|
|
||||||
final class FB2Tag {
|
final class FB2Tag {
|
||||||
public static final byte UNKNOWN = 0;
|
public static final byte UNKNOWN = 0;
|
||||||
|
@ -59,9 +58,9 @@ final class FB2Tag {
|
||||||
public static final byte LAST_NAME = 32;
|
public static final byte LAST_NAME = 32;
|
||||||
public static final byte SEQUENCE = 33;
|
public static final byte SEQUENCE = 33;
|
||||||
public static final byte GENRE = 34;
|
public static final byte GENRE = 34;
|
||||||
|
|
||||||
|
|
||||||
private static final HashMap ourTagByName = new HashMap(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 {
|
||||||
|
@ -105,8 +104,8 @@ final class FB2Tag {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static byte getTagByName(String name) {
|
public static byte getTagByName(String name) {
|
||||||
final HashMap tagByName = ourTagByName;
|
final HashMap<String,Byte> tagByName = ourTagByName;
|
||||||
Byte num = (Byte)tagByName.get(name);
|
Byte num = tagByName.get(name);
|
||||||
if (num == null) {
|
if (num == null) {
|
||||||
final String upperCaseName = name.toLowerCase().intern();
|
final String upperCaseName = name.toLowerCase().intern();
|
||||||
num = (Byte)tagByName.get(upperCaseName);
|
num = (Byte)tagByName.get(upperCaseName);
|
||||||
|
|
|
@ -20,9 +20,7 @@
|
||||||
package org.geometerplus.fbreader.formats.fb2;
|
package org.geometerplus.fbreader.formats.fb2;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import org.geometerplus.zlibrary.core.util.*;
|
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.core.library.ZLibrary;
|
|
||||||
import org.geometerplus.zlibrary.core.filesystem.ZLResourceFile;
|
import org.geometerplus.zlibrary.core.filesystem.ZLResourceFile;
|
||||||
import org.geometerplus.zlibrary.core.xml.*;
|
import org.geometerplus.zlibrary.core.xml.*;
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,6 @@ import org.geometerplus.fbreader.formats.FormatPlugin;
|
||||||
import org.geometerplus.zlibrary.core.filesystem.ZLFile;
|
import org.geometerplus.zlibrary.core.filesystem.ZLFile;
|
||||||
|
|
||||||
public class HtmlPlugin extends FormatPlugin {
|
public class HtmlPlugin extends FormatPlugin {
|
||||||
private final static String AUTO = "auto";
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean acceptsFile(ZLFile file) {
|
public boolean acceptsFile(ZLFile file) {
|
||||||
|
|
|
@ -26,9 +26,7 @@ import java.nio.charset.*;
|
||||||
import org.geometerplus.fbreader.bookmodel.BookModel;
|
import org.geometerplus.fbreader.bookmodel.BookModel;
|
||||||
import org.geometerplus.fbreader.bookmodel.BookReader;
|
import org.geometerplus.fbreader.bookmodel.BookReader;
|
||||||
import org.geometerplus.fbreader.bookmodel.FBTextKind;
|
import org.geometerplus.fbreader.bookmodel.FBTextKind;
|
||||||
import org.geometerplus.zlibrary.core.filesystem.ZLFile;
|
|
||||||
import org.geometerplus.zlibrary.core.html.*;
|
import org.geometerplus.zlibrary.core.html.*;
|
||||||
import org.geometerplus.zlibrary.core.image.ZLFileImage;
|
|
||||||
import org.geometerplus.zlibrary.core.util.ZLArrayUtils;
|
import org.geometerplus.zlibrary.core.util.ZLArrayUtils;
|
||||||
import org.geometerplus.zlibrary.text.model.ZLTextParagraph;
|
import org.geometerplus.zlibrary.text.model.ZLTextParagraph;
|
||||||
|
|
||||||
|
@ -64,10 +62,8 @@ public class HtmlReader extends BookReader implements ZLHtmlReader {
|
||||||
private byte myHyperlinkType;
|
private byte myHyperlinkType;
|
||||||
private final char[] SPACE = { ' ' };
|
private final char[] SPACE = { ' ' };
|
||||||
private String myHrefAttribute = "href";
|
private String myHrefAttribute = "href";
|
||||||
private String mySrcAttribute = "src";
|
|
||||||
private boolean myAdditionalParagraphExists = false;
|
|
||||||
private boolean myOrderedListIsStarted = false;
|
private boolean myOrderedListIsStarted = false;
|
||||||
private boolean myUnorderedListIsStarted = false;
|
//private boolean myUnorderedListIsStarted = false;
|
||||||
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;
|
||||||
|
@ -75,7 +71,7 @@ public class HtmlReader extends BookReader implements ZLHtmlReader {
|
||||||
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());
|
||||||
} catch (UnsupportedCharsetException e) {
|
} catch (UnsupportedCharsetException e) {
|
||||||
|
@ -225,7 +221,7 @@ public class HtmlReader extends BookReader implements ZLHtmlReader {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HtmlTag.UL:
|
case HtmlTag.UL:
|
||||||
myUnorderedListIsStarted = false;
|
//myUnorderedListIsStarted = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -318,7 +314,7 @@ public class HtmlReader extends BookReader implements ZLHtmlReader {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HtmlTag.UL:
|
case HtmlTag.UL:
|
||||||
myUnorderedListIsStarted = true;
|
//myUnorderedListIsStarted = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HtmlTag.LI:
|
case HtmlTag.LI:
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
package org.geometerplus.fbreader.formats.html;
|
package org.geometerplus.fbreader.formats.html;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import org.geometerplus.zlibrary.core.util.*;
|
|
||||||
|
|
||||||
public final class HtmlTag {
|
public final class HtmlTag {
|
||||||
public static final byte UNKNOWN = 0;
|
public static final byte UNKNOWN = 0;
|
||||||
|
@ -67,7 +66,7 @@ public final class HtmlTag {
|
||||||
|
|
||||||
public static final byte TAG_NUMBER = 37;
|
public static final byte TAG_NUMBER = 37;
|
||||||
|
|
||||||
private static final HashMap ourTagByName = new HashMap(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 {
|
||||||
|
@ -111,8 +110,8 @@ public final class HtmlTag {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static byte getTagByName(String name) {
|
public static byte getTagByName(String name) {
|
||||||
final HashMap tagByName = ourTagByName;
|
final HashMap<String,Byte> tagByName = ourTagByName;
|
||||||
Byte num = (Byte)tagByName.get(name);
|
Byte num = tagByName.get(name);
|
||||||
if (num == null) {
|
if (num == null) {
|
||||||
final String lowerCaseName = name.toLowerCase().intern();
|
final String lowerCaseName = name.toLowerCase().intern();
|
||||||
num = (Byte)tagByName.get(lowerCaseName);
|
num = (Byte)tagByName.get(lowerCaseName);
|
||||||
|
|
|
@ -40,7 +40,6 @@ class NCXReader extends ZLXMLReaderAdapter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final BookReader myModelReader;
|
|
||||||
private final TreeMap<Integer,NavPoint> myNavigationMap = new TreeMap<Integer,NavPoint>();
|
private final TreeMap<Integer,NavPoint> myNavigationMap = new TreeMap<Integer,NavPoint>();
|
||||||
private final ArrayList<NavPoint> myPointStack = new ArrayList<NavPoint>();
|
private final ArrayList<NavPoint> myPointStack = new ArrayList<NavPoint>();
|
||||||
|
|
||||||
|
@ -55,7 +54,6 @@ class NCXReader extends ZLXMLReaderAdapter {
|
||||||
private String myLocalPathPrefix;
|
private String myLocalPathPrefix;
|
||||||
|
|
||||||
NCXReader(BookReader modelReader) {
|
NCXReader(BookReader modelReader) {
|
||||||
myModelReader = modelReader;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean readFile(String filePath) {
|
boolean readFile(String filePath) {
|
||||||
|
|
|
@ -61,7 +61,6 @@ class OEBBookReader extends ZLXMLReaderAdapter implements XMLNamespace {
|
||||||
private TreeMap<String,Integer> myTOCLabels = new TreeMap<String,Integer>();
|
private TreeMap<String,Integer> myTOCLabels = new TreeMap<String,Integer>();
|
||||||
|
|
||||||
boolean readBook(ZLFile file) {
|
boolean readBook(ZLFile file) {
|
||||||
long start = System.currentTimeMillis();
|
|
||||||
myFilePrefix = MiscUtil.htmlDirectoryPrefix(file);
|
myFilePrefix = MiscUtil.htmlDirectoryPrefix(file);
|
||||||
|
|
||||||
myIdToHref.clear();
|
myIdToHref.clear();
|
||||||
|
|
|
@ -19,8 +19,6 @@
|
||||||
|
|
||||||
package org.geometerplus.fbreader.formats.oeb;
|
package org.geometerplus.fbreader.formats.oeb;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
import org.geometerplus.fbreader.bookmodel.BookModel;
|
import org.geometerplus.fbreader.bookmodel.BookModel;
|
||||||
import org.geometerplus.fbreader.library.Book;
|
import org.geometerplus.fbreader.library.Book;
|
||||||
import org.geometerplus.fbreader.formats.FormatPlugin;
|
import org.geometerplus.fbreader.formats.FormatPlugin;
|
||||||
|
|
|
@ -35,8 +35,6 @@ public abstract class PdbPlugin extends FormatPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static String fileType(final ZLFile file) {
|
protected static String fileType(final ZLFile file) {
|
||||||
ZLFile baseFile = file.getPhysicalFile();
|
|
||||||
|
|
||||||
// TODO: use database instead of option (?)
|
// TODO: use database instead of option (?)
|
||||||
ZLStringOption palmTypeOption = new ZLStringOption(file.getPath(), "PalmType", "");
|
ZLStringOption palmTypeOption = new ZLStringOption(file.getPath(), "PalmType", "");
|
||||||
String palmType = palmTypeOption.getValue();
|
String palmType = palmTypeOption.getValue();
|
||||||
|
|
|
@ -24,7 +24,6 @@ import java.io.InputStream;
|
||||||
|
|
||||||
import org.geometerplus.fbreader.formats.pdb.DocDecompressor;
|
import org.geometerplus.fbreader.formats.pdb.DocDecompressor;
|
||||||
import org.geometerplus.zlibrary.core.image.ZLSingleImage;
|
import org.geometerplus.zlibrary.core.image.ZLSingleImage;
|
||||||
import org.geometerplus.zlibrary.core.library.ZLibrary;
|
|
||||||
import org.geometerplus.zlibrary.core.filesystem.ZLFile;
|
import org.geometerplus.zlibrary.core.filesystem.ZLFile;
|
||||||
|
|
||||||
public class DocCompressedFileImage extends ZLSingleImage {
|
public class DocCompressedFileImage extends ZLSingleImage {
|
||||||
|
|
|
@ -24,7 +24,6 @@ import java.io.IOException;
|
||||||
import org.geometerplus.fbreader.bookmodel.BookModel;
|
import org.geometerplus.fbreader.bookmodel.BookModel;
|
||||||
import org.geometerplus.fbreader.library.Book;
|
import org.geometerplus.fbreader.library.Book;
|
||||||
import org.geometerplus.fbreader.formats.pdb.PdbPlugin;
|
import org.geometerplus.fbreader.formats.pdb.PdbPlugin;
|
||||||
import org.geometerplus.fbreader.formats.pdb.PdbStream;
|
|
||||||
import org.geometerplus.zlibrary.core.filesystem.ZLFile;
|
import org.geometerplus.zlibrary.core.filesystem.ZLFile;
|
||||||
|
|
||||||
public class PluckerPlugin extends PdbPlugin {
|
public class PluckerPlugin extends PdbPlugin {
|
||||||
|
|
|
@ -26,7 +26,6 @@ import java.util.zip.DataFormatException;
|
||||||
import java.util.zip.Inflater;
|
import java.util.zip.Inflater;
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.core.image.ZLSingleImage;
|
import org.geometerplus.zlibrary.core.image.ZLSingleImage;
|
||||||
import org.geometerplus.zlibrary.core.library.ZLibrary;
|
|
||||||
import org.geometerplus.zlibrary.core.filesystem.ZLFile;
|
import org.geometerplus.zlibrary.core.filesystem.ZLFile;
|
||||||
|
|
||||||
public class ZCompressedFileImage extends ZLSingleImage {
|
public class ZCompressedFileImage extends ZLSingleImage {
|
||||||
|
@ -48,7 +47,7 @@ public class ZCompressedFileImage extends ZLSingleImage {
|
||||||
return new byte[0];
|
return new byte[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
final ArrayList data = new ArrayList();
|
final ArrayList<byte[]> data = new ArrayList<byte[]>();
|
||||||
byte[] buffer;
|
byte[] buffer;
|
||||||
int sizeOfBufferData;
|
int sizeOfBufferData;
|
||||||
|
|
||||||
|
|
|
@ -20,9 +20,7 @@
|
||||||
package org.geometerplus.fbreader.formats.xhtml;
|
package org.geometerplus.fbreader.formats.xhtml;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.io.InputStream;
|
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.core.library.ZLibrary;
|
|
||||||
import org.geometerplus.zlibrary.core.xml.*;
|
import org.geometerplus.zlibrary.core.xml.*;
|
||||||
import org.geometerplus.zlibrary.core.filesystem.ZLFile;
|
import org.geometerplus.zlibrary.core.filesystem.ZLFile;
|
||||||
|
|
||||||
|
@ -30,7 +28,7 @@ import org.geometerplus.fbreader.bookmodel.*;
|
||||||
import org.geometerplus.fbreader.formats.util.MiscUtil;
|
import org.geometerplus.fbreader.formats.util.MiscUtil;
|
||||||
|
|
||||||
public class XHTMLReader extends ZLXMLReaderAdapter {
|
public class XHTMLReader extends ZLXMLReaderAdapter {
|
||||||
private static final HashMap ourTagActions = new HashMap();
|
private static final HashMap<String,XHTMLTagAction> ourTagActions = new HashMap<String,XHTMLTagAction>();
|
||||||
|
|
||||||
public static XHTMLTagAction addAction(String tag, XHTMLTagAction action) {
|
public static XHTMLTagAction addAction(String tag, XHTMLTagAction action) {
|
||||||
XHTMLTagAction old = (XHTMLTagAction)ourTagActions.get(tag);
|
XHTMLTagAction old = (XHTMLTagAction)ourTagActions.get(tag);
|
||||||
|
|
|
@ -19,9 +19,6 @@
|
||||||
|
|
||||||
package org.geometerplus.fbreader.library;
|
package org.geometerplus.fbreader.library;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
import org.geometerplus.zlibrary.core.util.*;
|
|
||||||
|
|
||||||
public final class Author {
|
public final class Author {
|
||||||
public final String DisplayName;
|
public final String DisplayName;
|
||||||
public final String SortKey;
|
public final String SortKey;
|
||||||
|
|
|
@ -23,7 +23,6 @@ import java.io.File;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.core.filesystem.*;
|
import org.geometerplus.zlibrary.core.filesystem.*;
|
||||||
import org.geometerplus.zlibrary.core.library.ZLibrary;
|
|
||||||
import org.geometerplus.fbreader.Paths;
|
import org.geometerplus.fbreader.Paths;
|
||||||
|
|
||||||
public final class Library {
|
public final class Library {
|
||||||
|
@ -121,7 +120,7 @@ public final class Library {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void collectBooks() {
|
private void collectBooks() {
|
||||||
final long start = System.currentTimeMillis();
|
//final long start = System.currentTimeMillis();
|
||||||
//android.os.Debug.startMethodTracing("/sdcard/ll0");
|
//android.os.Debug.startMethodTracing("/sdcard/ll0");
|
||||||
final List<ZLPhysicalFile> physicalFilesList = collectPhysicalFiles();
|
final List<ZLPhysicalFile> physicalFilesList = collectPhysicalFiles();
|
||||||
//android.os.Debug.stopMethodTracing();
|
//android.os.Debug.stopMethodTracing();
|
||||||
|
|
|
@ -107,7 +107,7 @@ public final class NetworkBookItem extends NetworkLibraryItem {
|
||||||
Tags = new LinkedList<String>(tags);
|
Tags = new LinkedList<String>(tags);
|
||||||
SeriesTitle = seriesTitle;
|
SeriesTitle = seriesTitle;
|
||||||
IndexInSeries = indexInSeries;
|
IndexInSeries = indexInSeries;
|
||||||
myReferences = new LinkedList(references);
|
myReferences = new LinkedList<BookReference>(references);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BookReference reference(int type) {
|
public BookReference reference(int type) {
|
||||||
|
|
|
@ -23,7 +23,6 @@ import java.io.*;
|
||||||
import java.net.*;
|
import java.net.*;
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.core.image.ZLSingleImage;
|
import org.geometerplus.zlibrary.core.image.ZLSingleImage;
|
||||||
import org.geometerplus.zlibrary.core.util.ZLNetworkUtil;
|
|
||||||
import org.geometerplus.zlibrary.core.network.*;
|
import org.geometerplus.zlibrary.core.network.*;
|
||||||
|
|
||||||
import org.geometerplus.fbreader.Paths;
|
import org.geometerplus.fbreader.Paths;
|
||||||
|
|
|
@ -60,7 +60,7 @@ abstract public class NetworkLink {
|
||||||
Summary = summary;
|
Summary = summary;
|
||||||
Icon = icon;
|
Icon = icon;
|
||||||
OnOption = new ZLBooleanOption(SiteName, "on", true);
|
OnOption = new ZLBooleanOption(SiteName, "on", true);
|
||||||
Links = new TreeMap(links);
|
Links = new TreeMap<String, String>(links);
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract ZLNetworkRequest simpleSearchRequest(String pattern, NetworkOperationData data);
|
public abstract ZLNetworkRequest simpleSearchRequest(String pattern, NetworkOperationData data);
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
package org.geometerplus.fbreader.network.authentication;
|
package org.geometerplus.fbreader.network.authentication;
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.core.options.ZLStringOption;
|
import org.geometerplus.zlibrary.core.options.ZLStringOption;
|
||||||
import org.geometerplus.zlibrary.core.options.ZLBooleanOption;
|
|
||||||
|
|
||||||
import org.geometerplus.fbreader.network.*;
|
import org.geometerplus.fbreader.network.*;
|
||||||
|
|
||||||
|
|
|
@ -19,14 +19,13 @@
|
||||||
|
|
||||||
package org.geometerplus.fbreader.network.authentication.litres;
|
package org.geometerplus.fbreader.network.authentication.litres;
|
||||||
|
|
||||||
import java.util.LinkedList;
|
/*import java.util.LinkedList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
class LitResGenreMap {
|
class LitResGenreMap {
|
||||||
|
|
||||||
private static LitResGenreMap ourInstance;
|
private static LitResGenreMap ourInstance;
|
||||||
|
|
||||||
private boolean myInitialized;
|
|
||||||
LinkedList<LitResGenre> myGenresTree;
|
LinkedList<LitResGenre> myGenresTree;
|
||||||
HashMap<String, LitResGenre> myGenresMap;
|
HashMap<String, LitResGenre> myGenresMap;
|
||||||
HashMap<LitResGenre, String> myGenresTitles;
|
HashMap<LitResGenre, String> myGenresTitles;
|
||||||
|
@ -41,3 +40,4 @@ class LitResGenreMap {
|
||||||
private LitResGenreMap() {
|
private LitResGenreMap() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
|
@ -36,8 +36,8 @@ class LitResXMLReader extends LitResAuthenticationXMLReader {
|
||||||
|
|
||||||
private String myBookId;
|
private String myBookId;
|
||||||
private String myTitle;
|
private String myTitle;
|
||||||
private String myLanguage;
|
//private String myLanguage;
|
||||||
private String myDate;
|
//private String myDate;
|
||||||
private String mySeriesTitle;
|
private String mySeriesTitle;
|
||||||
private int myIndexInSeries;
|
private int myIndexInSeries;
|
||||||
|
|
||||||
|
@ -233,7 +233,7 @@ class LitResXMLReader extends LitResAuthenticationXMLReader {
|
||||||
myReferences
|
myReferences
|
||||||
));
|
));
|
||||||
|
|
||||||
myBookId = myTitle = myLanguage = myDate = mySeriesTitle = mySummary = myCover = null;
|
myBookId = myTitle = /*myLanguage = myDate = */mySeriesTitle = mySummary = myCover = null;
|
||||||
myIndexInSeries = 0;
|
myIndexInSeries = 0;
|
||||||
myAuthors.clear();
|
myAuthors.clear();
|
||||||
myTags.clear();
|
myTags.clear();
|
||||||
|
@ -329,13 +329,13 @@ class LitResXMLReader extends LitResAuthenticationXMLReader {
|
||||||
break;
|
break;
|
||||||
case DATE:
|
case DATE:
|
||||||
if (TAG_DATE == tag) {
|
if (TAG_DATE == tag) {
|
||||||
myDate = bufferContent;
|
//myDate = bufferContent;
|
||||||
myState = TITLE_INFO;
|
myState = TITLE_INFO;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case LANGUAGE:
|
case LANGUAGE:
|
||||||
if (TAG_LANGUAGE == tag) {
|
if (TAG_LANGUAGE == tag) {
|
||||||
myLanguage = bufferContent;
|
//myLanguage = bufferContent;
|
||||||
myState = TITLE_INFO;
|
myState = TITLE_INFO;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -149,12 +149,12 @@ class NetworkOPDSFeedReader implements OPDSFeedReader {
|
||||||
|
|
||||||
private NetworkLibraryItem readBookItem(OPDSEntry entry) {
|
private NetworkLibraryItem readBookItem(OPDSEntry entry) {
|
||||||
final OPDSLink opdsLink = (OPDSLink) myData.Link;
|
final OPDSLink opdsLink = (OPDSLink) myData.Link;
|
||||||
final String date;
|
/*final String date;
|
||||||
if (entry.DCIssued != null) {
|
if (entry.DCIssued != null) {
|
||||||
date = entry.DCIssued.getDateTime(true);
|
date = entry.DCIssued.getDateTime(true);
|
||||||
} else {
|
} else {
|
||||||
date = null;
|
date = null;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
final LinkedList<String> tags = new LinkedList<String>();
|
final LinkedList<String> tags = new LinkedList<String>();
|
||||||
for (ATOMCategory category: entry.Categories) {
|
for (ATOMCategory category: entry.Categories) {
|
||||||
|
|
|
@ -51,7 +51,7 @@ class OPDSLink extends NetworkLink {
|
||||||
|
|
||||||
final void setRelationAliases(Map<RelationAlias, String> relationAliases) {
|
final void setRelationAliases(Map<RelationAlias, String> relationAliases) {
|
||||||
if (relationAliases != null && relationAliases.size() > 0) {
|
if (relationAliases != null && relationAliases.size() > 0) {
|
||||||
myRelationAliases = new TreeMap(relationAliases);
|
myRelationAliases = new TreeMap<RelationAlias, String>(relationAliases);
|
||||||
} else {
|
} else {
|
||||||
myRelationAliases = null;
|
myRelationAliases = null;
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ class OPDSLink extends NetworkLink {
|
||||||
|
|
||||||
final void setUrlConditions(Map<String, Integer> conditions) {
|
final void setUrlConditions(Map<String, Integer> conditions) {
|
||||||
if (conditions != null && conditions.size() > 0) {
|
if (conditions != null && conditions.size() > 0) {
|
||||||
myUrlConditions = new TreeMap(conditions);
|
myUrlConditions = new TreeMap<String, Integer>(conditions);
|
||||||
} else {
|
} else {
|
||||||
myUrlConditions = null;
|
myUrlConditions = null;
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ class OPDSLink extends NetworkLink {
|
||||||
|
|
||||||
final void setUrlRewritingRules(List<URLRewritingRule> rules) {
|
final void setUrlRewritingRules(List<URLRewritingRule> rules) {
|
||||||
if (rules != null && rules.size() > 0) {
|
if (rules != null && rules.size() > 0) {
|
||||||
myUrlRewritingRules = new LinkedList(rules);
|
myUrlRewritingRules = new LinkedList<URLRewritingRule>(rules);
|
||||||
} else {
|
} else {
|
||||||
myUrlRewritingRules = null;
|
myUrlRewritingRules = null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ public class OPDSLinkReader extends ZLXMLReaderAdapter {
|
||||||
|
|
||||||
private HashMap<RelationAlias, String> myRelationAliases = new HashMap<RelationAlias, String>();
|
private HashMap<RelationAlias, String> myRelationAliases = new HashMap<RelationAlias, String>();
|
||||||
|
|
||||||
private String mySearchType;
|
//private String mySearchType;
|
||||||
private final HashMap<String, String> mySearchFields = new HashMap<String, String>();
|
private final HashMap<String, String> mySearchFields = new HashMap<String, String>();
|
||||||
|
|
||||||
private final HashMap<String, Integer> myUrlConditions = new HashMap<String, Integer>();
|
private final HashMap<String, Integer> myUrlConditions = new HashMap<String, Integer>();
|
||||||
|
@ -88,7 +88,7 @@ public class OPDSLinkReader extends ZLXMLReaderAdapter {
|
||||||
}
|
}
|
||||||
|
|
||||||
public NetworkLink readDocument(ZLFile file) {
|
public NetworkLink readDocument(ZLFile file) {
|
||||||
mySiteName = myTitle = mySummary = myIcon = mySearchType = myAuthenticationType = mySSLCertificate = null;
|
mySiteName = myTitle = mySummary = myIcon = /*mySearchType = */myAuthenticationType = mySSLCertificate = null;
|
||||||
myLinks.clear();
|
myLinks.clear();
|
||||||
mySearchFields.clear();
|
mySearchFields.clear();
|
||||||
myUrlConditions.clear();
|
myUrlConditions.clear();
|
||||||
|
@ -168,7 +168,7 @@ public class OPDSLinkReader extends ZLXMLReaderAdapter {
|
||||||
} else if (TAG_SEARCH_DESCRIPTION == tag) {
|
} else if (TAG_SEARCH_DESCRIPTION == tag) {
|
||||||
String searchType = attributes.getValue("style");
|
String searchType = attributes.getValue("style");
|
||||||
if (searchType != null) {
|
if (searchType != null) {
|
||||||
mySearchType = searchType;
|
//mySearchType = searchType;
|
||||||
myState = READ_SEARCH_DESCRIPTION;
|
myState = READ_SEARCH_DESCRIPTION;
|
||||||
}
|
}
|
||||||
} else if (myState == READ_SEARCH_DESCRIPTION && TAG_FIELD == tag) {
|
} else if (myState == READ_SEARCH_DESCRIPTION && TAG_FIELD == tag) {
|
||||||
|
|
|
@ -19,11 +19,8 @@
|
||||||
|
|
||||||
package org.geometerplus.fbreader.network.tree;
|
package org.geometerplus.fbreader.network.tree;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.core.image.ZLImage;
|
import org.geometerplus.zlibrary.core.image.ZLImage;
|
||||||
|
|
||||||
import org.geometerplus.fbreader.tree.FBTree;
|
|
||||||
import org.geometerplus.fbreader.network.*;
|
import org.geometerplus.fbreader.network.*;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -19,8 +19,6 @@
|
||||||
|
|
||||||
package org.geometerplus.fbreader.network.tree;
|
package org.geometerplus.fbreader.network.tree;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
import org.geometerplus.fbreader.network.*;
|
import org.geometerplus.fbreader.network.*;
|
||||||
|
|
||||||
public class NetworkCatalogRootTree extends NetworkCatalogTree {
|
public class NetworkCatalogRootTree extends NetworkCatalogTree {
|
||||||
|
|
|
@ -19,11 +19,8 @@
|
||||||
|
|
||||||
package org.geometerplus.fbreader.network.tree;
|
package org.geometerplus.fbreader.network.tree;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.core.util.ZLBoolean3;
|
import org.geometerplus.zlibrary.core.util.ZLBoolean3;
|
||||||
|
|
||||||
import org.geometerplus.fbreader.tree.FBTree;
|
|
||||||
import org.geometerplus.fbreader.network.*;
|
import org.geometerplus.fbreader.network.*;
|
||||||
|
|
||||||
public class NetworkTreeFactory {
|
public class NetworkTreeFactory {
|
||||||
|
|
|
@ -20,10 +20,8 @@
|
||||||
package org.geometerplus.fbreader.optionsDialog;
|
package org.geometerplus.fbreader.optionsDialog;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.core.dialogs.ZLComboOptionEntry;
|
import org.geometerplus.zlibrary.core.dialogs.ZLComboOptionEntry;
|
||||||
|
@ -31,7 +29,7 @@ import org.geometerplus.zlibrary.core.dialogs.ZLOptionEntry;
|
||||||
|
|
||||||
class ComboOptionEntry extends ZLComboOptionEntry {
|
class ComboOptionEntry extends ZLComboOptionEntry {
|
||||||
protected final OptionsPage myPage;
|
protected final OptionsPage myPage;
|
||||||
protected final ArrayList /*<std::string>*/ myValues = new ArrayList();
|
protected final ArrayList<String> myValues = new ArrayList<String>();
|
||||||
protected String myInitialValue;
|
protected String myInitialValue;
|
||||||
|
|
||||||
public ComboOptionEntry(final OptionsPage myPage, String myInitialValue) {
|
public ComboOptionEntry(final OptionsPage myPage, String myInitialValue) {
|
||||||
|
@ -39,7 +37,7 @@ class ComboOptionEntry extends ZLComboOptionEntry {
|
||||||
this.myInitialValue = myInitialValue;
|
this.myInitialValue = myInitialValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList getValues() {
|
public ArrayList<String> getValues() {
|
||||||
return myValues;
|
return myValues;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,13 +47,15 @@ class ComboOptionEntry extends ZLComboOptionEntry {
|
||||||
|
|
||||||
public void onAccept(String value) {}
|
public void onAccept(String value) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void onReset() {
|
public void onReset() {
|
||||||
onValueSelected(0);
|
onValueSelected(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void onValueSelected(int index) {
|
public void onValueSelected(int index) {
|
||||||
final Object selectedValue = myValues.get(index);
|
final Object selectedValue = myValues.get(index);
|
||||||
final LinkedHashMap /*<ZLOptionEntry*,std::string>*/ entries = myPage.getEntries();
|
final LinkedHashMap<ZLOptionEntry, String> entries = myPage.getEntries();
|
||||||
/* for (Iterator it = entries.keySet().iterator(); it.hasNext(); ) {
|
/* for (Iterator it = entries.keySet().iterator(); it.hasNext(); ) {
|
||||||
ZLOptionEntry entry = (ZLOptionEntry) it.next();
|
ZLOptionEntry entry = (ZLOptionEntry) it.next();
|
||||||
entry.setVisible(selectedValue != null && selectedValue.equals(entries.get(entry)));
|
entry.setVisible(selectedValue != null && selectedValue.equals(entries.get(entry)));
|
||||||
|
@ -63,12 +63,12 @@ class ComboOptionEntry extends ZLComboOptionEntry {
|
||||||
System.out.println(entry.getKind()+" "+entry.hashCode());
|
System.out.println(entry.getKind()+" "+entry.hashCode());
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
for (Iterator it = entries.entrySet().iterator(); it.hasNext(); ) {
|
for (Iterator<Entry<ZLOptionEntry, String>> it = entries.entrySet().iterator(); it.hasNext(); ) {
|
||||||
Entry entry = (Entry) it.next();
|
Entry<ZLOptionEntry, String> entry = it.next();
|
||||||
((ZLOptionEntry) entry.getKey()).setVisible(selectedValue != null && selectedValue.equals(entry.getValue()));
|
entry.getKey().setVisible(selectedValue != null && selectedValue.equals(entry.getValue()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addValue(final String value) {
|
public void addValue(final String value) {
|
||||||
myValues.add(value);
|
myValues.add(value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,12 +22,10 @@ package org.geometerplus.fbreader.optionsDialog;
|
||||||
import org.geometerplus.zlibrary.core.library.ZLibrary;
|
import org.geometerplus.zlibrary.core.library.ZLibrary;
|
||||||
import org.geometerplus.zlibrary.core.dialogs.*;
|
import org.geometerplus.zlibrary.core.dialogs.*;
|
||||||
import org.geometerplus.zlibrary.core.optionEntries.*;
|
import org.geometerplus.zlibrary.core.optionEntries.*;
|
||||||
import org.geometerplus.zlibrary.core.options.*;
|
//import org.geometerplus.zlibrary.core.options.*;
|
||||||
import org.geometerplus.zlibrary.core.resources.ZLResource;
|
import org.geometerplus.zlibrary.core.resources.ZLResource;
|
||||||
import org.geometerplus.zlibrary.text.view.style.*;
|
|
||||||
|
|
||||||
import org.geometerplus.fbreader.fbreader.*;
|
import org.geometerplus.fbreader.fbreader.*;
|
||||||
import org.geometerplus.fbreader.formats.PluginCollection;
|
|
||||||
|
|
||||||
public class OptionsDialog {
|
public class OptionsDialog {
|
||||||
private ZLOptionsDialog myDialog;
|
private ZLOptionsDialog myDialog;
|
||||||
|
@ -81,7 +79,7 @@ public class OptionsDialog {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class StateOptionEntry extends ZLToggleBooleanOptionEntry {
|
/*private static class StateOptionEntry extends ZLToggleBooleanOptionEntry {
|
||||||
private boolean myState;
|
private boolean myState;
|
||||||
|
|
||||||
public StateOptionEntry(ZLBooleanOption option) {
|
public StateOptionEntry(ZLBooleanOption option) {
|
||||||
|
@ -111,5 +109,5 @@ public class OptionsDialog {
|
||||||
(mySecond.isVisible() && mySecond.myState)
|
(mySecond.isVisible() && mySecond.myState)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,9 +24,9 @@ import java.util.*;
|
||||||
import org.geometerplus.zlibrary.core.dialogs.*;
|
import org.geometerplus.zlibrary.core.dialogs.*;
|
||||||
|
|
||||||
class OptionsPage {
|
class OptionsPage {
|
||||||
private final LinkedHashMap /*<ZLOptionEntry, String>*/ myEntries = new LinkedHashMap();
|
private final LinkedHashMap<ZLOptionEntry, String> myEntries = new LinkedHashMap<ZLOptionEntry, String>();
|
||||||
protected ComboOptionEntry myComboEntry;
|
protected ComboOptionEntry myComboEntry;
|
||||||
|
|
||||||
protected OptionsPage() {
|
protected OptionsPage() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ class OptionsPage {
|
||||||
tab.addOptions(entry0Key, entry0, entry1Key, entry1);
|
tab.addOptions(entry0Key, entry0, entry1Key, entry1);
|
||||||
}
|
}
|
||||||
|
|
||||||
LinkedHashMap getEntries() {
|
LinkedHashMap<ZLOptionEntry, String> getEntries() {
|
||||||
return myEntries;
|
return myEntries;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,12 +20,8 @@
|
||||||
package org.geometerplus.zlibrary.core.application;
|
package org.geometerplus.zlibrary.core.application;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import org.geometerplus.zlibrary.core.util.*;
|
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.core.filesystem.*;
|
import org.geometerplus.zlibrary.core.filesystem.*;
|
||||||
import org.geometerplus.zlibrary.core.library.ZLibrary;
|
|
||||||
import org.geometerplus.zlibrary.core.options.ZLBooleanOption;
|
|
||||||
import org.geometerplus.zlibrary.core.options.ZLIntegerOption;
|
|
||||||
import org.geometerplus.zlibrary.core.options.ZLIntegerRangeOption;
|
import org.geometerplus.zlibrary.core.options.ZLIntegerRangeOption;
|
||||||
import org.geometerplus.zlibrary.core.resources.ZLResource;
|
import org.geometerplus.zlibrary.core.resources.ZLResource;
|
||||||
import org.geometerplus.zlibrary.core.view.ZLView;
|
import org.geometerplus.zlibrary.core.view.ZLView;
|
||||||
|
@ -39,8 +35,8 @@ public abstract class ZLApplication {
|
||||||
|
|
||||||
private static ZLApplication ourInstance;
|
private static ZLApplication ourInstance;
|
||||||
|
|
||||||
private static final String MouseScrollUpKey = "<MouseScrollDown>";
|
//private static final String MouseScrollUpKey = "<MouseScrollDown>";
|
||||||
private static final String MouseScrollDownKey = "<MouseScrollUp>";
|
//private static final String MouseScrollDownKey = "<MouseScrollUp>";
|
||||||
public static final String NoAction = "none";
|
public static final String NoAction = "none";
|
||||||
|
|
||||||
public final ZLIntegerRangeOption KeyDelayOption =
|
public final ZLIntegerRangeOption KeyDelayOption =
|
||||||
|
@ -218,7 +214,7 @@ public abstract class ZLApplication {
|
||||||
public interface Item {
|
public interface Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
private final ArrayList myItems = new ArrayList();
|
private final ArrayList<Item> myItems = new ArrayList<Item>();
|
||||||
private final ZLResource myResource;
|
private final ZLResource myResource;
|
||||||
|
|
||||||
Menu(ZLResource resource) {
|
Menu(ZLResource resource) {
|
||||||
|
@ -317,17 +313,19 @@ public abstract class ZLApplication {
|
||||||
private static final String ITEM = "item";
|
private static final String ITEM = "item";
|
||||||
private static final String SUBMENU = "submenu";
|
private static final String SUBMENU = "submenu";
|
||||||
|
|
||||||
private final ArrayList mySubmenuStack = new ArrayList();
|
private final ArrayList<Menubar.Submenu> mySubmenuStack = new ArrayList<Menubar.Submenu>();
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean dontCacheAttributeValues() {
|
public boolean dontCacheAttributeValues() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean startElementHandler(String tag, ZLStringMap attributes) {
|
public boolean startElementHandler(String tag, ZLStringMap attributes) {
|
||||||
if (myMenubar == null) {
|
if (myMenubar == null) {
|
||||||
myMenubar = new Menubar();
|
myMenubar = new Menubar();
|
||||||
}
|
}
|
||||||
final ArrayList stack = mySubmenuStack;
|
final ArrayList<Menubar.Submenu> stack = mySubmenuStack;
|
||||||
final Menu menu = stack.isEmpty() ? myMenubar : (Menu)stack.get(stack.size() - 1);
|
final Menu menu = stack.isEmpty() ? myMenubar : (Menu)stack.get(stack.size() - 1);
|
||||||
if (ITEM == tag) {
|
if (ITEM == tag) {
|
||||||
final String id = attributes.getValue("id");
|
final String id = attributes.getValue("id");
|
||||||
|
@ -343,9 +341,10 @@ public abstract class ZLApplication {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean endElementHandler(String tag) {
|
public boolean endElementHandler(String tag) {
|
||||||
if (SUBMENU == tag) {
|
if (SUBMENU == tag) {
|
||||||
final ArrayList stack = mySubmenuStack;
|
final ArrayList<Menubar.Submenu> stack = mySubmenuStack;
|
||||||
if (!stack.isEmpty()) {
|
if (!stack.isEmpty()) {
|
||||||
stack.remove(stack.size() - 1);
|
stack.remove(stack.size() - 1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,9 +19,6 @@
|
||||||
|
|
||||||
package org.geometerplus.zlibrary.core.application;
|
package org.geometerplus.zlibrary.core.application;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
import org.geometerplus.zlibrary.core.util.*;
|
|
||||||
|
|
||||||
abstract public class ZLApplicationWindow {
|
abstract public class ZLApplicationWindow {
|
||||||
private ZLApplication myApplication;
|
private ZLApplication myApplication;
|
||||||
|
|
||||||
|
|
|
@ -20,11 +20,7 @@
|
||||||
package org.geometerplus.zlibrary.core.application;
|
package org.geometerplus.zlibrary.core.application;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.Map.Entry;
|
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.core.util.*;
|
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.core.options.ZLIntegerOption;
|
|
||||||
import org.geometerplus.zlibrary.core.options.ZLIntegerRangeOption;
|
import org.geometerplus.zlibrary.core.options.ZLIntegerRangeOption;
|
||||||
import org.geometerplus.zlibrary.core.options.ZLStringOption;
|
import org.geometerplus.zlibrary.core.options.ZLStringOption;
|
||||||
|
|
||||||
|
@ -34,7 +30,7 @@ public final class ZLKeyBindings {
|
||||||
private static final String BINDED_ACTION = "Action";
|
private static final String BINDED_ACTION = "Action";
|
||||||
|
|
||||||
private final String myName;
|
private final String myName;
|
||||||
private final HashMap myBindingsMap = new HashMap();
|
private final HashMap<String, String> myBindingsMap = new HashMap<String, String>();
|
||||||
private boolean myIsChanged;
|
private boolean myIsChanged;
|
||||||
|
|
||||||
public ZLKeyBindings(String name) {
|
public ZLKeyBindings(String name) {
|
||||||
|
@ -78,15 +74,15 @@ public final class ZLKeyBindings {
|
||||||
if (!myIsChanged) {
|
if (!myIsChanged) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final HashMap keymap = new HashMap();
|
final HashMap<String, String> keymap = new HashMap<String, String>();
|
||||||
new ZLKeyBindingsReader(keymap).readBindings();
|
new ZLKeyBindingsReader(keymap).readBindings();
|
||||||
|
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
for (Iterator it = myBindingsMap.keySet().iterator(); it.hasNext(); ) {
|
for (Iterator<String> it = myBindingsMap.keySet().iterator(); it.hasNext(); ) {
|
||||||
final String key = (String)it.next();
|
final String key = it.next();
|
||||||
final String originalValue = (String)keymap.get(key);
|
final String originalValue = keymap.get(key);
|
||||||
final String value = (String)myBindingsMap.get(key);
|
final String value = myBindingsMap.get(key);
|
||||||
if (!value.equals(originalValue)) {
|
if (!value.equals(originalValue)) {
|
||||||
new ZLStringOption(myName, BINDED_KEY + counter, "").setValue(key);
|
new ZLStringOption(myName, BINDED_KEY + counter, "").setValue(key);
|
||||||
new ZLStringOption(myName, BINDED_ACTION + counter, "").setValue(value);
|
new ZLStringOption(myName, BINDED_ACTION + counter, "").setValue(value);
|
||||||
|
|
|
@ -20,22 +20,24 @@
|
||||||
package org.geometerplus.zlibrary.core.application;
|
package org.geometerplus.zlibrary.core.application;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.core.filesystem.ZLResourceFile;
|
import org.geometerplus.zlibrary.core.filesystem.ZLResourceFile;
|
||||||
import org.geometerplus.zlibrary.core.library.ZLibrary;
|
|
||||||
import org.geometerplus.zlibrary.core.xml.ZLStringMap;
|
import org.geometerplus.zlibrary.core.xml.ZLStringMap;
|
||||||
import org.geometerplus.zlibrary.core.xml.ZLXMLReaderAdapter;
|
import org.geometerplus.zlibrary.core.xml.ZLXMLReaderAdapter;
|
||||||
|
|
||||||
class ZLKeyBindingsReader extends ZLXMLReaderAdapter {
|
class ZLKeyBindingsReader extends ZLXMLReaderAdapter {
|
||||||
private final HashMap myKeymap;
|
private final HashMap<String, String> myKeymap;
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean dontCacheAttributeValues() {
|
public boolean dontCacheAttributeValues() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ZLKeyBindingsReader(HashMap keymap) {
|
public ZLKeyBindingsReader(HashMap<String, String> keymap) {
|
||||||
myKeymap = keymap;
|
myKeymap = keymap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean startElementHandler(String tag, ZLStringMap attributes) {
|
public boolean startElementHandler(String tag, ZLStringMap attributes) {
|
||||||
if ("binding".equals(tag)) {
|
if ("binding".equals(tag)) {
|
||||||
final String key = attributes.getValue("key");
|
final String key = attributes.getValue("key");
|
||||||
|
|
|
@ -20,46 +20,45 @@
|
||||||
package org.geometerplus.zlibrary.core.dialogs;
|
package org.geometerplus.zlibrary.core.dialogs;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import org.geometerplus.zlibrary.core.util.*;
|
|
||||||
|
|
||||||
public abstract class ZLComboOptionEntry extends ZLOptionEntry {
|
public abstract class ZLComboOptionEntry extends ZLOptionEntry {
|
||||||
private final boolean myEditable;
|
private final boolean myEditable;
|
||||||
|
|
||||||
protected ZLComboOptionEntry() {
|
protected ZLComboOptionEntry() {
|
||||||
myEditable = false;
|
myEditable = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ZLComboOptionEntry(boolean editable) {
|
protected ZLComboOptionEntry(boolean editable) {
|
||||||
myEditable = editable;
|
myEditable = editable;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getKind() {
|
public int getKind() {
|
||||||
return ZLOptionKind.COMBO;
|
return ZLOptionKind.COMBO;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onValueSelected(int index) {}
|
public void onValueSelected(int index) {}
|
||||||
|
|
||||||
public final void onStringValueSelected(String value) {
|
public final void onStringValueSelected(String value) {
|
||||||
int index = getValues().indexOf(value);
|
int index = getValues().indexOf(value);
|
||||||
if (index != -1) {
|
if (index != -1) {
|
||||||
onValueSelected(index);
|
onValueSelected(index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean useOnValueEdited() {
|
public boolean useOnValueEdited() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onValueEdited(String value) {}
|
public void onValueEdited(String value) {}
|
||||||
|
|
||||||
public final boolean isEditable() {
|
public final boolean isEditable() {
|
||||||
return myEditable;
|
return myEditable;
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract String initialValue();
|
public abstract String initialValue();
|
||||||
|
|
||||||
public abstract ArrayList/*<String>*/ getValues();
|
public abstract ArrayList<String> getValues();
|
||||||
|
|
||||||
public abstract void onAccept(String value);
|
public abstract void onAccept(String value);
|
||||||
|
|
||||||
public void onReset() {
|
public void onReset() {
|
||||||
|
|
|
@ -21,8 +21,6 @@ package org.geometerplus.zlibrary.core.dialogs;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.core.util.*;
|
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.core.resources.ZLResource;
|
import org.geometerplus.zlibrary.core.resources.ZLResource;
|
||||||
import org.geometerplus.zlibrary.core.optionEntries.ZLSimpleBoolean3OptionEntry;
|
import org.geometerplus.zlibrary.core.optionEntries.ZLSimpleBoolean3OptionEntry;
|
||||||
import org.geometerplus.zlibrary.core.optionEntries.ZLSimpleBooleanOptionEntry;
|
import org.geometerplus.zlibrary.core.optionEntries.ZLSimpleBooleanOptionEntry;
|
||||||
|
@ -31,8 +29,8 @@ import org.geometerplus.zlibrary.core.options.*;
|
||||||
|
|
||||||
public abstract class ZLDialogContent {
|
public abstract class ZLDialogContent {
|
||||||
private final ZLResource myResource;
|
private final ZLResource myResource;
|
||||||
protected final ArrayList Views = new ArrayList();
|
protected final ArrayList<ZLOptionView> Views = new ArrayList<ZLOptionView>();
|
||||||
|
|
||||||
private static ZLOptionEntry createEntryByOption(ZLSimpleOption option) {
|
private static ZLOptionEntry createEntryByOption(ZLSimpleOption option) {
|
||||||
switch (option.getType()) {
|
switch (option.getType()) {
|
||||||
case ZLSimpleOption.Type.BOOLEAN:
|
case ZLSimpleOption.Type.BOOLEAN:
|
||||||
|
@ -91,14 +89,14 @@ public abstract class ZLDialogContent {
|
||||||
protected final void accept() {
|
protected final void accept() {
|
||||||
final int size = Views.size();
|
final int size = Views.size();
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
((ZLOptionView)Views.get(i)).onAccept();
|
Views.get(i).onAccept();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final void reset() {
|
final void reset() {
|
||||||
final int size = Views.size();
|
final int size = Views.size();
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
((ZLOptionView)Views.get(i)).reset();
|
Views.get(i).reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,10 +20,9 @@
|
||||||
package org.geometerplus.zlibrary.core.dialogs;
|
package org.geometerplus.zlibrary.core.dialogs;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import org.geometerplus.zlibrary.core.util.*;
|
|
||||||
|
|
||||||
public abstract class ZLKeyOptionEntry extends ZLOptionEntry {
|
public abstract class ZLKeyOptionEntry extends ZLOptionEntry {
|
||||||
private final ArrayList/*<String>*/ myActionNames = new ArrayList();
|
private final ArrayList<String> myActionNames = new ArrayList<String>();
|
||||||
|
|
||||||
public ZLKeyOptionEntry() {}
|
public ZLKeyOptionEntry() {}
|
||||||
|
|
||||||
|
@ -35,7 +34,7 @@ public abstract class ZLKeyOptionEntry extends ZLOptionEntry {
|
||||||
myActionNames.add(actionName);
|
myActionNames.add(actionName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final ArrayList getActionNames() {
|
public final ArrayList<String> getActionNames() {
|
||||||
return myActionNames;
|
return myActionNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,14 +20,13 @@
|
||||||
package org.geometerplus.zlibrary.core.dialogs;
|
package org.geometerplus.zlibrary.core.dialogs;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import org.geometerplus.zlibrary.core.util.*;
|
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.core.options.*;
|
import org.geometerplus.zlibrary.core.options.*;
|
||||||
import org.geometerplus.zlibrary.core.resources.ZLResource;
|
import org.geometerplus.zlibrary.core.resources.ZLResource;
|
||||||
|
|
||||||
public abstract class ZLOptionsDialog {
|
public abstract class ZLOptionsDialog {
|
||||||
private final ZLResource myResource;
|
private final ZLResource myResource;
|
||||||
protected final ArrayList /*ZLDialogContent*/ myTabs = new ArrayList();
|
protected final ArrayList<ZLDialogContent> myTabs = new ArrayList<ZLDialogContent>();
|
||||||
protected Runnable myExitAction;
|
protected Runnable myExitAction;
|
||||||
protected Runnable myApplyAction;
|
protected Runnable myApplyAction;
|
||||||
protected ZLStringOption myTabOption;
|
protected ZLStringOption myTabOption;
|
||||||
|
@ -53,7 +52,7 @@ public abstract class ZLOptionsDialog {
|
||||||
protected void accept() {
|
protected void accept() {
|
||||||
final int size = myTabs.size();
|
final int size = myTabs.size();
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
((ZLDialogContent)myTabs.get(i)).accept();
|
myTabs.get(i).accept();
|
||||||
}
|
}
|
||||||
if (myApplyAction != null) {
|
if (myApplyAction != null) {
|
||||||
myApplyAction.run();
|
myApplyAction.run();
|
||||||
|
|
|
@ -19,8 +19,7 @@
|
||||||
|
|
||||||
package org.geometerplus.zlibrary.core.dialogs;
|
package org.geometerplus.zlibrary.core.dialogs;
|
||||||
|
|
||||||
import java.util.*;
|
/*import java.util.*;
|
||||||
import org.geometerplus.zlibrary.core.util.*;
|
|
||||||
|
|
||||||
public abstract class ZLOrderOptionEntry extends ZLOptionEntry {
|
public abstract class ZLOrderOptionEntry extends ZLOptionEntry {
|
||||||
private final ArrayList myValues = new ArrayList();
|
private final ArrayList myValues = new ArrayList();
|
||||||
|
@ -36,3 +35,4 @@ public abstract class ZLOrderOptionEntry extends ZLOptionEntry {
|
||||||
return myValues;
|
return myValues;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
|
@ -22,7 +22,6 @@ package org.geometerplus.zlibrary.core.encoding;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.core.filesystem.ZLResourceFile;
|
import org.geometerplus.zlibrary.core.filesystem.ZLResourceFile;
|
||||||
import org.geometerplus.zlibrary.core.library.ZLibrary;
|
|
||||||
import org.geometerplus.zlibrary.core.xml.ZLStringMap;
|
import org.geometerplus.zlibrary.core.xml.ZLStringMap;
|
||||||
import org.geometerplus.zlibrary.core.xml.ZLXMLReaderAdapter;
|
import org.geometerplus.zlibrary.core.xml.ZLXMLReaderAdapter;
|
||||||
|
|
||||||
|
|
|
@ -22,8 +22,6 @@ package org.geometerplus.zlibrary.core.filesystem;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.core.library.ZLibrary;
|
|
||||||
|
|
||||||
public final class ZLPhysicalFile extends ZLFile {
|
public final class ZLPhysicalFile extends ZLFile {
|
||||||
private final File myFile;
|
private final File myFile;
|
||||||
|
|
||||||
|
|
|
@ -19,8 +19,6 @@
|
||||||
|
|
||||||
package org.geometerplus.zlibrary.core.filesystem;
|
package org.geometerplus.zlibrary.core.filesystem;
|
||||||
|
|
||||||
import java.io.*;
|
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.core.library.ZLibrary;
|
import org.geometerplus.zlibrary.core.library.ZLibrary;
|
||||||
|
|
||||||
public abstract class ZLResourceFile extends ZLFile {
|
public abstract class ZLResourceFile extends ZLFile {
|
||||||
|
|
|
@ -24,11 +24,11 @@ import java.io.IOException;
|
||||||
|
|
||||||
class ZLTarInputStream extends InputStream {
|
class ZLTarInputStream extends InputStream {
|
||||||
private final InputStream myBase;
|
private final InputStream myBase;
|
||||||
private final String myFileName;
|
//private final String myFileName;
|
||||||
|
|
||||||
ZLTarInputStream(InputStream base, String fileName) throws IOException {
|
ZLTarInputStream(InputStream base, String fileName) throws IOException {
|
||||||
myBase = base;
|
myBase = base;
|
||||||
myFileName = fileName;
|
//myFileName = fileName;
|
||||||
|
|
||||||
ZLTarHeader header = new ZLTarHeader();
|
ZLTarHeader header = new ZLTarHeader();
|
||||||
while (header.read(myBase)) {
|
while (header.read(myBase)) {
|
||||||
|
@ -51,18 +51,22 @@ class ZLTarInputStream extends InputStream {
|
||||||
return myBase.read();
|
return myBase.read();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int read(byte b[]) throws IOException {
|
public int read(byte b[]) throws IOException {
|
||||||
return myBase.read(b);
|
return myBase.read(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int read(byte b[], int off, int len) throws IOException {
|
public int read(byte b[], int off, int len) throws IOException {
|
||||||
return myBase.read(b, off, len);
|
return myBase.read(b, off, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public long skip(long n) throws IOException {
|
public long skip(long n) throws IOException {
|
||||||
return myBase.skip(n);
|
return myBase.skip(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int available() throws IOException {
|
public int available() throws IOException {
|
||||||
return myBase.available();
|
return myBase.available();
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,8 +21,6 @@ package org.geometerplus.zlibrary.core.html;
|
||||||
|
|
||||||
import java.nio.charset.CharsetDecoder;
|
import java.nio.charset.CharsetDecoder;
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.core.util.ZLArrayUtils;
|
|
||||||
|
|
||||||
// optimized partially implemented map ZLByteBuffer -> ZLByteBuffer
|
// optimized partially implemented map ZLByteBuffer -> ZLByteBuffer
|
||||||
// there is no remove() in this implementation
|
// there is no remove() in this implementation
|
||||||
// put with the same key does not remove old entry
|
// put with the same key does not remove old entry
|
||||||
|
|
|
@ -21,7 +21,6 @@ package org.geometerplus.zlibrary.core.html;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import org.geometerplus.zlibrary.core.util.*;
|
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.core.util.ZLArrayUtils;
|
import org.geometerplus.zlibrary.core.util.ZLArrayUtils;
|
||||||
import org.geometerplus.zlibrary.core.html.ZLHtmlReader;
|
import org.geometerplus.zlibrary.core.html.ZLHtmlReader;
|
||||||
|
@ -31,8 +30,8 @@ final class ZLHtmlParser {
|
||||||
private static final byte START_TAG = 1;
|
private static final byte START_TAG = 1;
|
||||||
private static final byte END_TAG = 2;
|
private static final byte END_TAG = 2;
|
||||||
private static final byte TEXT = 3;
|
private static final byte TEXT = 3;
|
||||||
private static final byte IGNORABLE_WHITESPACE = 4;
|
//private static final byte IGNORABLE_WHITESPACE = 4;
|
||||||
private static final byte PROCESSING_INSTRUCTION = 5;
|
//private static final byte PROCESSING_INSTRUCTION = 5;
|
||||||
private static final byte COMMENT = 6;
|
private static final byte COMMENT = 6;
|
||||||
private static final byte LANGLE = 7;
|
private static final byte LANGLE = 7;
|
||||||
private static final byte WS_AFTER_START_TAG_NAME = 8;
|
private static final byte WS_AFTER_START_TAG_NAME = 8;
|
||||||
|
@ -77,7 +76,7 @@ final class ZLHtmlParser {
|
||||||
final HashMap<ZLByteBuffer,ZLByteBuffer> strings = new HashMap<ZLByteBuffer,ZLByteBuffer>();
|
final HashMap<ZLByteBuffer,ZLByteBuffer> strings = new HashMap<ZLByteBuffer,ZLByteBuffer>();
|
||||||
final ZLHtmlAttributeMap attributes = new ZLHtmlAttributeMap();
|
final ZLHtmlAttributeMap attributes = new ZLHtmlAttributeMap();
|
||||||
boolean scriptOpened = false;
|
boolean scriptOpened = false;
|
||||||
boolean html = false;
|
//boolean html = false;
|
||||||
int bufferOffset = 0;
|
int bufferOffset = 0;
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
|
|
||||||
|
@ -191,9 +190,9 @@ mainSwitchLabel:
|
||||||
state = SCRIPT;
|
state = SCRIPT;
|
||||||
break mainSwitchLabel;
|
break mainSwitchLabel;
|
||||||
}
|
}
|
||||||
if (stringTagName.equalsToLCString("html")) {
|
/*if (stringTagName.equalsToLCString("html")) {
|
||||||
html = true;
|
html = true;
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
startPosition = i + 1;
|
startPosition = i + 1;
|
||||||
break mainSwitchLabel;
|
break mainSwitchLabel;
|
||||||
|
|
|
@ -20,9 +20,10 @@
|
||||||
package org.geometerplus.zlibrary.core.image;
|
package org.geometerplus.zlibrary.core.image;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import org.geometerplus.zlibrary.core.util.*;
|
|
||||||
|
|
||||||
public final class ZLImageMap extends HashMap {
|
public final class ZLImageMap extends HashMap<String,ZLImage> {
|
||||||
|
private static final long serialVersionUID = -4488377408233803199L;
|
||||||
|
|
||||||
public ZLImage getImage(String id) {
|
public ZLImage getImage(String id) {
|
||||||
return (ZLImage)super.get(id);
|
return (ZLImage)super.get(id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,8 +27,8 @@ import org.geometerplus.zlibrary.core.language.ZLLanguageMatcher.ZLWordBasedMatc
|
||||||
import org.geometerplus.zlibrary.core.util.ZLUnicodeUtil;
|
import org.geometerplus.zlibrary.core.util.ZLUnicodeUtil;
|
||||||
|
|
||||||
public class ZLLanguageDetector {
|
public class ZLLanguageDetector {
|
||||||
private ArrayList myUtf8Matchers = new ArrayList();
|
private ArrayList<ZLWordBasedMatcher> myUtf8Matchers = new ArrayList<ZLWordBasedMatcher>();
|
||||||
private ArrayList myNonUtf8Matchers = new ArrayList();
|
private ArrayList<ZLWordBasedMatcher> myNonUtf8Matchers = new ArrayList<ZLWordBasedMatcher>();
|
||||||
//private ArrayList<ZLChineseMatcher> myChineseMatchers;
|
//private ArrayList<ZLChineseMatcher> myChineseMatchers;
|
||||||
|
|
||||||
// 0: no break
|
// 0: no break
|
||||||
|
@ -137,8 +137,8 @@ public class ZLLanguageDetector {
|
||||||
}
|
}
|
||||||
String str = new String(buffer);
|
String str = new String(buffer);
|
||||||
word += str.substring(wordStart,wordStart + ptr - wordStart);
|
word += str.substring(wordStart,wordStart + ptr - wordStart);
|
||||||
for (Iterator it = wbMatchers.iterator(); it.hasNext(); ) {
|
for (Iterator<ZLWordBasedMatcher> it = wbMatchers.iterator(); it.hasNext(); ) {
|
||||||
((ZLWordBasedMatcher)it.next()).processWord(word, length2);
|
it.next().processWord(word, length2);
|
||||||
}
|
}
|
||||||
word = "";
|
word = "";
|
||||||
}
|
}
|
||||||
|
@ -157,8 +157,8 @@ public class ZLLanguageDetector {
|
||||||
|
|
||||||
LanguageInfo info = null;
|
LanguageInfo info = null;
|
||||||
|
|
||||||
for (Iterator it = wbMatchers.iterator(); it.hasNext(); ) {
|
for (Iterator<ZLWordBasedMatcher> it = wbMatchers.iterator(); it.hasNext(); ) {
|
||||||
ZLWordBasedMatcher itzl = (ZLWordBasedMatcher)it.next();
|
ZLWordBasedMatcher itzl = it.next();
|
||||||
int criterion = itzl.criterion();
|
int criterion = itzl.criterion();
|
||||||
if (criterion > matchingCriterion) {
|
if (criterion > matchingCriterion) {
|
||||||
info = itzl.info();
|
info = itzl.info();
|
||||||
|
|
|
@ -19,22 +19,20 @@
|
||||||
|
|
||||||
package org.geometerplus.zlibrary.core.language;
|
package org.geometerplus.zlibrary.core.language;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.core.filesystem.*;
|
import org.geometerplus.zlibrary.core.filesystem.*;
|
||||||
import org.geometerplus.zlibrary.core.library.ZLibrary;
|
|
||||||
import org.geometerplus.zlibrary.core.resources.ZLResource;
|
import org.geometerplus.zlibrary.core.resources.ZLResource;
|
||||||
|
|
||||||
public abstract class ZLLanguageList {
|
public abstract class ZLLanguageList {
|
||||||
private static ArrayList<String> ourLanguageCodes = new ArrayList();
|
private static ArrayList<String> ourLanguageCodes = new ArrayList<String>();
|
||||||
|
|
||||||
private ZLLanguageList() {
|
private ZLLanguageList() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<String> languageCodes() {
|
public static List<String> languageCodes() {
|
||||||
if (ourLanguageCodes.isEmpty()) {
|
if (ourLanguageCodes.isEmpty()) {
|
||||||
TreeSet codes = new TreeSet();
|
TreeSet<String> codes = new TreeSet<String>();
|
||||||
for (ZLFile file : patternsFile().children()) {
|
for (ZLFile file : patternsFile().children()) {
|
||||||
String name = file.getName(false);
|
String name = file.getName(false);
|
||||||
final int index = name.indexOf("_");
|
final int index = name.indexOf("_");
|
||||||
|
|
|
@ -54,7 +54,12 @@ public abstract class ZLLanguageMatcher {
|
||||||
};
|
};
|
||||||
|
|
||||||
static class ZLLanguagePatternBasedMatcher extends ZLWordBasedMatcher {
|
static class ZLLanguagePatternBasedMatcher extends ZLWordBasedMatcher {
|
||||||
public ZLLanguagePatternBasedMatcher(ZLFile file, ZLLanguageDetector.LanguageInfo info) {
|
|
||||||
|
private int myProCounter;
|
||||||
|
private int myContraCounter;
|
||||||
|
private ArrayList<String> myDictionary = new ArrayList<String>();
|
||||||
|
|
||||||
|
public ZLLanguagePatternBasedMatcher(ZLFile file, ZLLanguageDetector.LanguageInfo info) {
|
||||||
super(info);
|
super(info);
|
||||||
try{
|
try{
|
||||||
InputStream dictionaryStream = file.getInputStream();
|
InputStream dictionaryStream = file.getInputStream();
|
||||||
|
@ -101,9 +106,5 @@ public abstract class ZLLanguageMatcher {
|
||||||
public int criterion() {
|
public int criterion() {
|
||||||
return myProCounter * 2000 / (myProCounter + myContraCounter) - 1000;
|
return myProCounter * 2000 / (myProCounter + myContraCounter) - 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int myProCounter;
|
|
||||||
private int myContraCounter;
|
|
||||||
private ArrayList/*<String>*/ myDictionary = new ArrayList();
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
package org.geometerplus.zlibrary.core.network;
|
package org.geometerplus.zlibrary.core.network;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.net.*;
|
|
||||||
import javax.net.ssl.*;
|
import javax.net.ssl.*;
|
||||||
import java.security.GeneralSecurityException;
|
import java.security.GeneralSecurityException;
|
||||||
import java.security.cert.*;
|
import java.security.cert.*;
|
||||||
|
|
|
@ -62,23 +62,23 @@ public class ZLColorOptionBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ZLColor getColor() {
|
public ZLColor getColor() {
|
||||||
Object color = myData.myCurrentColors.get(myData.myCurrentOptionName);
|
ZLColor color = myData.myCurrentColors.get(myData.myCurrentOptionName);
|
||||||
return (color != null) ? (ZLColor)color : initialColor();
|
return (color != null) ? color : initialColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ZLColor initialColor() {
|
public ZLColor initialColor() {
|
||||||
return ((ZLColorOption)myData.myOptions.get(myData.myCurrentOptionName)).getValue();
|
return myData.myOptions.get(myData.myCurrentOptionName).getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onAccept(ZLColor color) {
|
public void onAccept(ZLColor color) {
|
||||||
onReset(color);
|
onReset(color);
|
||||||
final ArrayList optionNames = myData.myOptionNames;
|
final ArrayList<String> optionNames = myData.myOptionNames;
|
||||||
final HashMap options = myData.myOptions;
|
final HashMap<String,ZLColorOption> options = myData.myOptions;
|
||||||
final HashMap colors = myData.myCurrentColors;
|
final HashMap<String,ZLColor> colors = myData.myCurrentColors;
|
||||||
final int len = optionNames.size();
|
final int len = optionNames.size();
|
||||||
for (int i = 0; i < len; i++) {
|
for (int i = 0; i < len; i++) {
|
||||||
Object name = optionNames.get(i);
|
String name = optionNames.get(i);
|
||||||
((ZLColorOption)options.get(name)).setValue((ZLColor)colors.get(name));
|
options.get(name).setValue(colors.get(name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ public class ZLColorOptionBuilder {
|
||||||
myData = data;
|
myData = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList getValues() {
|
public ArrayList<String> getValues() {
|
||||||
return myData.myOptionNames;
|
return myData.myOptionNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ public class ZLColorOptionBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onValueSelected(int index) {
|
public void onValueSelected(int index) {
|
||||||
myData.myCurrentOptionName = (String)getValues().get(index);
|
myData.myCurrentOptionName = getValues().get(index);
|
||||||
myData.myColorEntry.resetView();
|
myData.myColorEntry.resetView();
|
||||||
myData.myPreviousOptionName = myData.myCurrentOptionName;
|
myData.myPreviousOptionName = myData.myCurrentOptionName;
|
||||||
}
|
}
|
||||||
|
@ -120,8 +120,8 @@ public class ZLColorOptionBuilder {
|
||||||
private ZLColorOptionEntry myColorEntry;
|
private ZLColorOptionEntry myColorEntry;
|
||||||
private String myCurrentOptionName;
|
private String myCurrentOptionName;
|
||||||
private String myPreviousOptionName;
|
private String myPreviousOptionName;
|
||||||
private final ArrayList/*<String>*/ myOptionNames = new ArrayList();
|
private final ArrayList<String> myOptionNames = new ArrayList<String>();
|
||||||
private final HashMap/*<String,ZLColor>*/ myCurrentColors = new HashMap();
|
private final HashMap<String,ZLColor> myCurrentColors = new HashMap<String,ZLColor>();
|
||||||
private final HashMap/*<String,ZLColorOption>*/ myOptions = new HashMap();
|
private final HashMap<String,ZLColorOption> myOptions = new HashMap<String,ZLColorOption>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ public class ZLFontFamilyOptionEntry extends ZLComboOptionEntry {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList getValues() {
|
public ArrayList<String> getValues() {
|
||||||
return myContext.fontFamilies();
|
return myContext.fontFamilies();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,13 +21,12 @@ package org.geometerplus.zlibrary.core.optionEntries;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.core.util.*;
|
|
||||||
import org.geometerplus.zlibrary.core.dialogs.ZLOptionEntry;
|
import org.geometerplus.zlibrary.core.dialogs.ZLOptionEntry;
|
||||||
import org.geometerplus.zlibrary.core.options.ZLBooleanOption;
|
import org.geometerplus.zlibrary.core.options.ZLBooleanOption;
|
||||||
|
|
||||||
public class ZLToggleBooleanOptionEntry extends ZLSimpleBooleanOptionEntry {
|
public class ZLToggleBooleanOptionEntry extends ZLSimpleBooleanOptionEntry {
|
||||||
private final ArrayList myDependentEntries = new ArrayList();
|
private final ArrayList<ZLOptionEntry> myDependentEntries = new ArrayList<ZLOptionEntry>();
|
||||||
|
|
||||||
public ZLToggleBooleanOptionEntry(ZLBooleanOption option) {
|
public ZLToggleBooleanOptionEntry(ZLBooleanOption option) {
|
||||||
super(option);
|
super(option);
|
||||||
}
|
}
|
||||||
|
@ -35,14 +34,16 @@ public class ZLToggleBooleanOptionEntry extends ZLSimpleBooleanOptionEntry {
|
||||||
public void addDependentEntry(ZLOptionEntry dependent) {
|
public void addDependentEntry(ZLOptionEntry dependent) {
|
||||||
myDependentEntries.add(dependent);
|
myDependentEntries.add(dependent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void onStateChanged(boolean state) {
|
public void onStateChanged(boolean state) {
|
||||||
final int size = myDependentEntries.size();
|
final int size = myDependentEntries.size();
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
((ZLOptionEntry)myDependentEntries.get(i)).setVisible(state);
|
myDependentEntries.get(i).setVisible(state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void onReset() {
|
public void onReset() {
|
||||||
onStateChanged(initialState());
|
onStateChanged(initialState());
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,8 +19,6 @@
|
||||||
|
|
||||||
package org.geometerplus.zlibrary.core.resources;
|
package org.geometerplus.zlibrary.core.resources;
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.core.library.ZLibrary;
|
|
||||||
|
|
||||||
abstract public class ZLResource {
|
abstract public class ZLResource {
|
||||||
public final String Name;
|
public final String Name;
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,6 @@ package org.geometerplus.zlibrary.core.resources;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.core.library.ZLibrary;
|
|
||||||
import org.geometerplus.zlibrary.core.xml.ZLStringMap;
|
import org.geometerplus.zlibrary.core.xml.ZLStringMap;
|
||||||
import org.geometerplus.zlibrary.core.xml.ZLXMLReaderAdapter;
|
import org.geometerplus.zlibrary.core.xml.ZLXMLReaderAdapter;
|
||||||
import org.geometerplus.zlibrary.core.filesystem.*;
|
import org.geometerplus.zlibrary.core.filesystem.*;
|
||||||
|
@ -91,10 +90,12 @@ final class ZLTreeResource extends ZLResource {
|
||||||
read(file);
|
read(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean dontCacheAttributeValues() {
|
public boolean dontCacheAttributeValues() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean startElementHandler(String tag, ZLStringMap attributes) {
|
public boolean startElementHandler(String tag, ZLStringMap attributes) {
|
||||||
final ArrayList<ZLTreeResource> stack = myStack;
|
final ArrayList<ZLTreeResource> stack = myStack;
|
||||||
if (!stack.isEmpty() && (NODE.equals(tag))) {
|
if (!stack.isEmpty() && (NODE.equals(tag))) {
|
||||||
|
@ -125,8 +126,9 @@ final class ZLTreeResource extends ZLResource {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean endElementHandler(String tag) {
|
public boolean endElementHandler(String tag) {
|
||||||
final ArrayList stack = myStack;
|
final ArrayList<ZLTreeResource> stack = myStack;
|
||||||
if (!stack.isEmpty() && (NODE.equals(tag))) {
|
if (!stack.isEmpty() && (NODE.equals(tag))) {
|
||||||
stack.remove(stack.size() - 1);
|
stack.remove(stack.size() - 1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
package org.geometerplus.zlibrary.core.sqliteconfig;
|
package org.geometerplus.zlibrary.core.sqliteconfig;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.database.Cursor;
|
|
||||||
import android.database.SQLException;
|
import android.database.SQLException;
|
||||||
import android.database.sqlite.SQLiteDatabase;
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
import android.database.sqlite.SQLiteStatement;
|
import android.database.sqlite.SQLiteStatement;
|
||||||
|
|
|
@ -21,7 +21,7 @@ package org.geometerplus.zlibrary.core.tree;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public abstract class ZLTree<T extends ZLTree> implements Iterable<T> {
|
public abstract class ZLTree<T extends ZLTree<T>> implements Iterable<T> {
|
||||||
private int mySize = 1;
|
private int mySize = 1;
|
||||||
public final T Parent;
|
public final T Parent;
|
||||||
public final int Level;
|
public final int Level;
|
||||||
|
@ -50,7 +50,7 @@ public abstract class ZLTree<T extends ZLTree> implements Iterable<T> {
|
||||||
Parent = parent;
|
Parent = parent;
|
||||||
if (parent != null) {
|
if (parent != null) {
|
||||||
Level = parent.Level + 1;
|
Level = parent.Level + 1;
|
||||||
parent.addSubTree(this, position);
|
parent.addSubTree((T)this, position);
|
||||||
} else {
|
} else {
|
||||||
Level = nullLevel;
|
Level = nullLevel;
|
||||||
}
|
}
|
||||||
|
@ -100,14 +100,14 @@ public abstract class ZLTree<T extends ZLTree> implements Iterable<T> {
|
||||||
subtree = mySubTrees.set(position++, subtree);
|
subtree = mySubTrees.set(position++, subtree);
|
||||||
}
|
}
|
||||||
mySubTrees.add(subtree);
|
mySubTrees.add(subtree);
|
||||||
for (ZLTree parent = this; parent != null; parent = parent.Parent) {
|
for (ZLTree<?> parent = this; parent != null; parent = parent.Parent) {
|
||||||
parent.mySize += subTreeSize;
|
parent.mySize += subTreeSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeSelf() {
|
public void removeSelf() {
|
||||||
final int subTreeSize = getSize();
|
final int subTreeSize = getSize();
|
||||||
ZLTree parent = Parent;
|
ZLTree<?> parent = Parent;
|
||||||
if (parent != null) {
|
if (parent != null) {
|
||||||
parent.mySubTrees.remove(this);
|
parent.mySubTrees.remove(this);
|
||||||
if (parent.mySubTrees.isEmpty()) {
|
if (parent.mySubTrees.isEmpty()) {
|
||||||
|
@ -124,7 +124,7 @@ public abstract class ZLTree<T extends ZLTree> implements Iterable<T> {
|
||||||
mySubTrees = null;
|
mySubTrees = null;
|
||||||
mySize = 1;
|
mySize = 1;
|
||||||
if (subTreesSize > 0) {
|
if (subTreesSize > 0) {
|
||||||
for (ZLTree parent = Parent; parent != null; parent = parent.Parent) {
|
for (ZLTree<?> parent = Parent; parent != null; parent = parent.Parent) {
|
||||||
parent.mySize -= subTreesSize;
|
parent.mySize -= subTreesSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ import org.geometerplus.zlibrary.core.util.*;
|
||||||
import org.geometerplus.zlibrary.core.image.ZLImageData;
|
import org.geometerplus.zlibrary.core.image.ZLImageData;
|
||||||
|
|
||||||
abstract public class ZLPaintContext {
|
abstract public class ZLPaintContext {
|
||||||
private final ArrayList myFamilies = new ArrayList();
|
private final ArrayList<String> myFamilies = new ArrayList<String>();
|
||||||
|
|
||||||
public interface LineStyle {
|
public interface LineStyle {
|
||||||
int SOLID_LINE = 0;
|
int SOLID_LINE = 0;
|
||||||
|
@ -145,13 +145,13 @@ abstract public class ZLPaintContext {
|
||||||
abstract public void drawFilledCircle(int x, int y, int r);
|
abstract public void drawFilledCircle(int x, int y, int r);
|
||||||
abstract public void drawOutline(int[] xs, int ys[]);
|
abstract public void drawOutline(int[] xs, int ys[]);
|
||||||
|
|
||||||
public ArrayList fontFamilies() {
|
public ArrayList<String> fontFamilies() {
|
||||||
if (myFamilies.isEmpty()) {
|
if (myFamilies.isEmpty()) {
|
||||||
fillFamiliesList(myFamilies);
|
fillFamiliesList(myFamilies);
|
||||||
}
|
}
|
||||||
return myFamilies;
|
return myFamilies;
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract public String realFontFamilyName(String fontFamily);
|
abstract public String realFontFamilyName(String fontFamily);
|
||||||
abstract protected void fillFamiliesList(ArrayList families);
|
abstract protected void fillFamiliesList(ArrayList<String> families);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,8 +19,6 @@
|
||||||
|
|
||||||
package org.geometerplus.zlibrary.core.view;
|
package org.geometerplus.zlibrary.core.view;
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.core.application.ZLApplication;
|
|
||||||
|
|
||||||
abstract public class ZLView {
|
abstract public class ZLView {
|
||||||
public final ZLPaintContext Context;
|
public final ZLPaintContext Context;
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,6 @@ import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import org.geometerplus.zlibrary.core.util.*;
|
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.core.util.ZLArrayUtils;
|
import org.geometerplus.zlibrary.core.util.ZLArrayUtils;
|
||||||
|
|
||||||
|
@ -41,7 +40,7 @@ final class ZLDTDParser {
|
||||||
private static final byte VALUE = 10;
|
private static final byte VALUE = 10;
|
||||||
private static final byte WAIT_END_OF_ENTITY = 11;
|
private static final byte WAIT_END_OF_ENTITY = 11;
|
||||||
|
|
||||||
public void doIt(final InputStream stream, final HashMap entityMap) throws IOException {
|
public void doIt(final InputStream stream, final HashMap<String,char[]> entityMap) throws IOException {
|
||||||
final InputStreamReader streamReader = new InputStreamReader(stream, "us-ascii");
|
final InputStreamReader streamReader = new InputStreamReader(stream, "us-ascii");
|
||||||
|
|
||||||
char[] buffer = new char[8192];
|
char[] buffer = new char[8192];
|
||||||
|
|
|
@ -22,9 +22,7 @@ package org.geometerplus.zlibrary.core.xml;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import org.geometerplus.zlibrary.core.util.*;
|
|
||||||
import org.geometerplus.zlibrary.core.filesystem.*;
|
import org.geometerplus.zlibrary.core.filesystem.*;
|
||||||
import org.geometerplus.zlibrary.core.library.ZLibrary;
|
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.core.util.ZLArrayUtils;
|
import org.geometerplus.zlibrary.core.util.ZLArrayUtils;
|
||||||
import org.geometerplus.zlibrary.core.xml.ZLStringMap;
|
import org.geometerplus.zlibrary.core.xml.ZLStringMap;
|
||||||
|
@ -35,8 +33,8 @@ final class ZLXMLParser {
|
||||||
private static final byte START_TAG = 1;
|
private static final byte START_TAG = 1;
|
||||||
private static final byte END_TAG = 2;
|
private static final byte END_TAG = 2;
|
||||||
private static final byte TEXT = 3;
|
private static final byte TEXT = 3;
|
||||||
private static final byte IGNORABLE_WHITESPACE = 4;
|
//private static final byte IGNORABLE_WHITESPACE = 4;
|
||||||
private static final byte PROCESSING_INSTRUCTION = 5;
|
//private static final byte PROCESSING_INSTRUCTION = 5;
|
||||||
private static final byte COMMENT = 6; // tag of form <!-- -->
|
private static final byte COMMENT = 6; // tag of form <!-- -->
|
||||||
private static final byte END_OF_COMMENT1 = 7;
|
private static final byte END_OF_COMMENT1 = 7;
|
||||||
private static final byte END_OF_COMMENT2 = 8;
|
private static final byte END_OF_COMMENT2 = 8;
|
||||||
|
@ -172,7 +170,8 @@ final class ZLXMLParser {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ConcurrentHashMap<List<String>,HashMap<String,char[]>> ourDTDMaps = new ConcurrentHashMap(); // FIXME: concurrency violation
|
private static ConcurrentHashMap<List<String>,HashMap<String,char[]>> ourDTDMaps =
|
||||||
|
new ConcurrentHashMap<List<String>,HashMap<String,char[]>>(); // FIXME: concurrency violation
|
||||||
|
|
||||||
static HashMap<String,char[]> getDTDMap(List<String> dtdList) throws IOException {
|
static HashMap<String,char[]> getDTDMap(List<String> dtdList) throws IOException {
|
||||||
HashMap<String,char[]> entityMap = ourDTDMaps.get(dtdList);
|
HashMap<String,char[]> entityMap = ourDTDMaps.get(dtdList);
|
||||||
|
@ -194,7 +193,8 @@ final class ZLXMLParser {
|
||||||
return entityMap;
|
return entityMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
private final static ConcurrentHashMap ourStringMap = new ConcurrentHashMap();
|
private final static ConcurrentHashMap<ZLMutableString,String> ourStringMap =
|
||||||
|
new ConcurrentHashMap<ZLMutableString,String>();
|
||||||
|
|
||||||
void doIt() throws IOException {
|
void doIt() throws IOException {
|
||||||
final ZLXMLReader xmlReader = myXMLReader;
|
final ZLXMLReader xmlReader = myXMLReader;
|
||||||
|
@ -737,7 +737,7 @@ mainSwitchLabel:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean processStartTag(ZLXMLReader xmlReader, String tagName, ZLStringMap attributes, HashMap currentNamespaceMap) {
|
private static boolean processStartTag(ZLXMLReader xmlReader, String tagName, ZLStringMap attributes, HashMap<String,String> currentNamespaceMap) {
|
||||||
if (xmlReader.startElementHandler(tagName, attributes)) {
|
if (xmlReader.startElementHandler(tagName, attributes)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -748,7 +748,7 @@ mainSwitchLabel:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean processEndTag(ZLXMLReader xmlReader, String tagName, HashMap currentNamespaceMap) {
|
private static boolean processEndTag(ZLXMLReader xmlReader, String tagName, HashMap<String,String> currentNamespaceMap) {
|
||||||
if (currentNamespaceMap != null) {
|
if (currentNamespaceMap != null) {
|
||||||
xmlReader.namespaceMapChangedHandler(currentNamespaceMap);
|
xmlReader.namespaceMapChangedHandler(currentNamespaceMap);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,6 @@ import java.util.*;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.core.filesystem.ZLFile;
|
import org.geometerplus.zlibrary.core.filesystem.ZLFile;
|
||||||
import org.geometerplus.zlibrary.core.library.ZLibrary;
|
|
||||||
|
|
||||||
public abstract class ZLXMLProcessor {
|
public abstract class ZLXMLProcessor {
|
||||||
public static Map<String,char[]> getEntityMap(List<String> dtdList) {
|
public static Map<String,char[]> getEntityMap(List<String> dtdList) {
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
|
|
||||||
package org.geometerplus.zlibrary.text.hyphenation;
|
package org.geometerplus.zlibrary.text.hyphenation;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
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;
|
||||||
|
|
|
@ -19,8 +19,6 @@
|
||||||
|
|
||||||
package org.geometerplus.zlibrary.text.hyphenation;
|
package org.geometerplus.zlibrary.text.hyphenation;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
public final class ZLTextTeXHyphenationPattern {
|
public final class ZLTextTeXHyphenationPattern {
|
||||||
int myLength;
|
int myLength;
|
||||||
final char[] mySymbols;
|
final char[] mySymbols;
|
||||||
|
|
|
@ -21,13 +21,13 @@ package org.geometerplus.zlibrary.text.hyphenation;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import org.geometerplus.zlibrary.core.util.ZLMiscUtil;
|
import org.geometerplus.zlibrary.core.util.ZLMiscUtil;
|
||||||
import org.geometerplus.zlibrary.core.library.ZLibrary;
|
|
||||||
import org.geometerplus.zlibrary.core.filesystem.ZLResourceFile;
|
import org.geometerplus.zlibrary.core.filesystem.ZLResourceFile;
|
||||||
|
|
||||||
public final class ZLTextTeXHyphenator extends ZLTextHyphenator {
|
public final class ZLTextTeXHyphenator extends ZLTextHyphenator {
|
||||||
private final HashMap myPatternTable = new HashMap();
|
private final HashMap<ZLTextTeXHyphenationPattern,ZLTextTeXHyphenationPattern> myPatternTable =
|
||||||
|
new HashMap<ZLTextTeXHyphenationPattern,ZLTextTeXHyphenationPattern>();
|
||||||
private String myLanguage;
|
private String myLanguage;
|
||||||
|
|
||||||
public ZLTextTeXHyphenator() {
|
public ZLTextTeXHyphenator() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,8 +62,8 @@ public final class ZLTextTeXHyphenator extends ZLTextHyphenator {
|
||||||
}
|
}
|
||||||
|
|
||||||
byte[] values = new byte[length + 1];
|
byte[] values = new byte[length + 1];
|
||||||
|
|
||||||
final HashMap table = myPatternTable;
|
final HashMap<ZLTextTeXHyphenationPattern,ZLTextTeXHyphenationPattern> table = myPatternTable;
|
||||||
ZLTextTeXHyphenationPattern pattern =
|
ZLTextTeXHyphenationPattern pattern =
|
||||||
new ZLTextTeXHyphenationPattern(stringToHyphenate, 0, length, false);
|
new ZLTextTeXHyphenationPattern(stringToHyphenate, 0, length, false);
|
||||||
for (int offset = 0; offset < length - 1; offset++) {
|
for (int offset = 0; offset < length - 1; offset++) {
|
||||||
|
|
|
@ -22,9 +22,10 @@ package org.geometerplus.zlibrary.text.model;
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import org.geometerplus.zlibrary.core.util.*;
|
|
||||||
|
|
||||||
final class CachedCharStorageException extends RuntimeException {
|
final class CachedCharStorageException extends RuntimeException {
|
||||||
|
private static final long serialVersionUID = -6373408730045821053L;
|
||||||
|
|
||||||
public CachedCharStorageException(String message) {
|
public CachedCharStorageException(String message) {
|
||||||
super(message);
|
super(message);
|
||||||
}
|
}
|
||||||
|
@ -86,7 +87,7 @@ public final class CachedCharStorage implements CharStorage {
|
||||||
blockSize = minimumLength;
|
blockSize = minimumLength;
|
||||||
}
|
}
|
||||||
char[] block = new char[blockSize];
|
char[] block = new char[blockSize];
|
||||||
myArray.add(new WeakReference(block));
|
myArray.add(new WeakReference<char[]>(block));
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
package org.geometerplus.zlibrary.text.model;
|
package org.geometerplus.zlibrary.text.model;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import org.geometerplus.zlibrary.core.util.*;
|
|
||||||
|
|
||||||
final class SimpleCharStorage implements CharStorage {
|
final class SimpleCharStorage implements CharStorage {
|
||||||
private final int myBlockSize;
|
private final int myBlockSize;
|
||||||
|
|
|
@ -19,8 +19,6 @@
|
||||||
|
|
||||||
package org.geometerplus.zlibrary.text.model;
|
package org.geometerplus.zlibrary.text.model;
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.core.image.ZLImageMap;
|
|
||||||
|
|
||||||
public interface ZLTextWritableModel extends ZLTextModel {
|
public interface ZLTextWritableModel extends ZLTextModel {
|
||||||
void createParagraph(byte kind);
|
void createParagraph(byte kind);
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
|
|
||||||
package org.geometerplus.zlibrary.text.model;
|
package org.geometerplus.zlibrary.text.model;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
import org.geometerplus.zlibrary.core.util.*;
|
import org.geometerplus.zlibrary.core.util.*;
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.core.image.ZLImageMap;
|
import org.geometerplus.zlibrary.core.image.ZLImageMap;
|
||||||
|
|
|
@ -32,17 +32,15 @@ public class ZLTextAlignmentOptionEntry extends ZLComboOptionEntry {
|
||||||
private static final String KEY_JUSTIFY = "justify";
|
private static final String KEY_JUSTIFY = "justify";
|
||||||
private static final String KEY_UNCHANGED = "unchanged";
|
private static final String KEY_UNCHANGED = "unchanged";
|
||||||
|
|
||||||
private static final ArrayList ourValues4 = new ArrayList();
|
private static final ArrayList<String> ourValues4 = new ArrayList<String>();
|
||||||
private static final ArrayList ourValues5 = new ArrayList();
|
private static final ArrayList<String> ourValues5 = new ArrayList<String>();
|
||||||
|
|
||||||
private final ZLResource myResource;
|
|
||||||
private final ZLIntegerOption myOption;
|
private final ZLIntegerOption myOption;
|
||||||
private final boolean myAllowUndefined;
|
private final boolean myAllowUndefined;
|
||||||
|
|
||||||
public ZLTextAlignmentOptionEntry(ZLIntegerOption option, final ZLResource resource, boolean allowUndefined) {
|
public ZLTextAlignmentOptionEntry(ZLIntegerOption option, final ZLResource resource, boolean allowUndefined) {
|
||||||
myAllowUndefined = allowUndefined;
|
myAllowUndefined = allowUndefined;
|
||||||
myOption = option;
|
myOption = option;
|
||||||
myResource = resource;
|
|
||||||
if (ourValues5.isEmpty()) {
|
if (ourValues5.isEmpty()) {
|
||||||
ourValues5.add(resource.getResource(KEY_UNCHANGED).getValue());
|
ourValues5.add(resource.getResource(KEY_UNCHANGED).getValue());
|
||||||
String value = resource.getResource(KEY_LEFT).getValue();
|
String value = resource.getResource(KEY_LEFT).getValue();
|
||||||
|
@ -60,7 +58,7 @@ public class ZLTextAlignmentOptionEntry extends ZLComboOptionEntry {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList getValues() {
|
public ArrayList<String> getValues() {
|
||||||
return myAllowUndefined ? ourValues5 : ourValues4;
|
return myAllowUndefined ? ourValues5 : ourValues4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,8 @@ package org.geometerplus.zlibrary.text.view;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
final class ZLTextElementAreaVector extends ArrayList<ZLTextElementArea> {
|
final class ZLTextElementAreaVector extends ArrayList<ZLTextElementArea> {
|
||||||
|
private static final long serialVersionUID = -5045824474350948281L;
|
||||||
|
|
||||||
final ArrayList<ZLTextHyperlinkArea> HyperlinkAreas = new ArrayList<ZLTextHyperlinkArea>();
|
final ArrayList<ZLTextHyperlinkArea> HyperlinkAreas = new ArrayList<ZLTextHyperlinkArea>();
|
||||||
private ZLTextHyperlinkArea myCurrentHyperlinkArea;
|
private ZLTextHyperlinkArea myCurrentHyperlinkArea;
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ import org.geometerplus.zlibrary.core.resources.ZLResource;
|
||||||
import org.geometerplus.zlibrary.core.view.ZLPaintContext;
|
import org.geometerplus.zlibrary.core.view.ZLPaintContext;
|
||||||
|
|
||||||
public class ZLTextFontFamilyWithBaseOptionEntry extends ZLFontFamilyOptionEntry {
|
public class ZLTextFontFamilyWithBaseOptionEntry extends ZLFontFamilyOptionEntry {
|
||||||
private static final ArrayList ourAllFamilies = new ArrayList();
|
private static final ArrayList<String> ourAllFamilies = new ArrayList<String>();
|
||||||
|
|
||||||
private final ZLResource myResource;
|
private final ZLResource myResource;
|
||||||
|
|
||||||
|
@ -36,20 +36,23 @@ public class ZLTextFontFamilyWithBaseOptionEntry extends ZLFontFamilyOptionEntry
|
||||||
myResource = resource;
|
myResource = resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList getValues() {
|
@Override
|
||||||
|
public ArrayList<String> getValues() {
|
||||||
if (ourAllFamilies.size() == 0) {
|
if (ourAllFamilies.size() == 0) {
|
||||||
final ArrayList families = super.getValues();
|
final ArrayList<String> families = super.getValues();
|
||||||
ourAllFamilies.add(myResource.getResource("unchanged").getValue());
|
ourAllFamilies.add(myResource.getResource("unchanged").getValue());
|
||||||
ourAllFamilies.addAll(families);
|
ourAllFamilies.addAll(families);
|
||||||
}
|
}
|
||||||
return ourAllFamilies;
|
return ourAllFamilies;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String initialValue() {
|
public String initialValue() {
|
||||||
final String value = super.initialValue();
|
final String value = super.initialValue();
|
||||||
return ((value == null) || (value.length() == 0)) ? (String)(getValues().get(0)) : value;
|
return ((value == null) || (value.length() == 0)) ? getValues().get(0) : value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void onAccept(String value) {
|
public void onAccept(String value) {
|
||||||
super.onAccept((value.equals(getValues().get(0))) ? "" : value);
|
super.onAccept((value.equals(getValues().get(0))) ? "" : value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
package org.geometerplus.zlibrary.text.view;
|
package org.geometerplus.zlibrary.text.view;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import org.geometerplus.zlibrary.core.util.*;
|
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.core.dialogs.ZLComboOptionEntry;
|
import org.geometerplus.zlibrary.core.dialogs.ZLComboOptionEntry;
|
||||||
import org.geometerplus.zlibrary.core.options.ZLIntegerOption;
|
import org.geometerplus.zlibrary.core.options.ZLIntegerOption;
|
||||||
|
@ -29,8 +28,8 @@ import org.geometerplus.zlibrary.core.resources.ZLResource;
|
||||||
|
|
||||||
public class ZLTextLineSpaceOptionEntry extends ZLComboOptionEntry {
|
public class ZLTextLineSpaceOptionEntry extends ZLComboOptionEntry {
|
||||||
private static final String KEY_UNCHANGED = "unchanged";
|
private static final String KEY_UNCHANGED = "unchanged";
|
||||||
private static final ArrayList ourAllValues = new ArrayList();
|
private static final ArrayList<String> ourAllValues = new ArrayList<String>();
|
||||||
private static final ArrayList ourAllValuesPlusBase = new ArrayList();
|
private static final ArrayList<String> ourAllValuesPlusBase = new ArrayList<String>();
|
||||||
|
|
||||||
private final ZLIntegerOption myOption;
|
private final ZLIntegerOption myOption;
|
||||||
private final ZLResource myResource;
|
private final ZLResource myResource;
|
||||||
|
@ -48,18 +47,18 @@ public class ZLTextLineSpaceOptionEntry extends ZLComboOptionEntry {
|
||||||
ourAllValuesPlusBase.addAll(ourAllValues);
|
ourAllValuesPlusBase.addAll(ourAllValues);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList getValues() {
|
public ArrayList<String> getValues() {
|
||||||
return myAllowBase ? ourAllValuesPlusBase : ourAllValues;
|
return myAllowBase ? ourAllValuesPlusBase : ourAllValues;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String initialValue() {
|
public String initialValue() {
|
||||||
final int value = myOption.getValue();
|
final int value = myOption.getValue();
|
||||||
if (value == -1) {
|
if (value == -1) {
|
||||||
return (String) ourAllValuesPlusBase.get(0);
|
return ourAllValuesPlusBase.get(0);
|
||||||
}
|
}
|
||||||
final int index = Math.max(0, Math.min(15, (value + 5) / 10 - 5));
|
final int index = Math.max(0, Math.min(15, (value + 5) / 10 - 5));
|
||||||
return (String) ourAllValues.get(index);
|
return ourAllValues.get(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onAccept(String value) {
|
public void onAccept(String value) {
|
||||||
|
|
|
@ -96,7 +96,7 @@ public final class ZLTextParagraphCursor {
|
||||||
private static byte[] ourBreaks = new byte[1024];
|
private static byte[] ourBreaks = new byte[1024];
|
||||||
private static final int NO_SPACE = 0;
|
private static final int NO_SPACE = 0;
|
||||||
private static final int SPACE = 1;
|
private static final int SPACE = 1;
|
||||||
private static final int NON_BREAKABLE_SPACE = 2;
|
//private static final int NON_BREAKABLE_SPACE = 2;
|
||||||
private void processTextEntry(final char[] data, final int offset, final int length) {
|
private void processTextEntry(final char[] data, final int offset, final int length) {
|
||||||
if (length != 0) {
|
if (length != 0) {
|
||||||
if (ourBreaks.length < length) {
|
if (ourBreaks.length < length) {
|
||||||
|
|
|
@ -21,7 +21,6 @@ package org.geometerplus.zlibrary.text.view;
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import org.geometerplus.zlibrary.core.util.*;
|
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.text.model.ZLTextModel;
|
import org.geometerplus.zlibrary.text.model.ZLTextModel;
|
||||||
|
|
||||||
|
|
|
@ -100,7 +100,7 @@ final class ZLTextSelectionModel {
|
||||||
private boolean myIsActive;
|
private boolean myIsActive;
|
||||||
private boolean myIsEmpty = true;
|
private boolean myIsEmpty = true;
|
||||||
private boolean myDoUpdate;
|
private boolean myDoUpdate;
|
||||||
private boolean myTextIsUpToDate = true;
|
//private boolean myTextIsUpToDate = true;
|
||||||
|
|
||||||
private int myStoredX;
|
private int myStoredX;
|
||||||
private int myStoredY;
|
private int myStoredY;
|
||||||
|
@ -108,7 +108,6 @@ final class ZLTextSelectionModel {
|
||||||
private final Bound myFirstBound = new Bound();
|
private final Bound myFirstBound = new Bound();
|
||||||
private final Bound mySecondBound = new Bound();
|
private final Bound mySecondBound = new Bound();
|
||||||
|
|
||||||
private final HashSet myCursors = new HashSet();
|
|
||||||
private final StringBuilder myText = new StringBuilder();
|
private final StringBuilder myText = new StringBuilder();
|
||||||
|
|
||||||
ZLTextSelectionModel(ZLTextView view) {
|
ZLTextSelectionModel(ZLTextView view) {
|
||||||
|
@ -124,9 +123,8 @@ final class ZLTextSelectionModel {
|
||||||
myIsEmpty = false;
|
myIsEmpty = false;
|
||||||
setBound(myFirstBound, x, y);
|
setBound(myFirstBound, x, y);
|
||||||
mySecondBound.copyFrom(myFirstBound);
|
mySecondBound.copyFrom(myFirstBound);
|
||||||
myCursors.clear();
|
|
||||||
myText.delete(0, myText.length());
|
myText.delete(0, myText.length());
|
||||||
myTextIsUpToDate = true;
|
//myTextIsUpToDate = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean extendTo(int x, int y) {
|
boolean extendTo(int x, int y) {
|
||||||
|
@ -149,7 +147,7 @@ final class ZLTextSelectionModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!oldRange.Left.equalsTo(newRange.Left) || !oldRange.Right.equalsTo(newRange.Right)) {
|
if (!oldRange.Left.equalsTo(newRange.Left) || !oldRange.Right.equalsTo(newRange.Right)) {
|
||||||
myTextIsUpToDate = false;
|
//myTextIsUpToDate = false;
|
||||||
myText.delete(0, myText.length());
|
myText.delete(0, myText.length());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -163,7 +161,7 @@ final class ZLTextSelectionModel {
|
||||||
myDoUpdate = false;
|
myDoUpdate = false;
|
||||||
setBound(mySecondBound, myStoredX, myStoredY);
|
setBound(mySecondBound, myStoredX, myStoredY);
|
||||||
//myView.copySelectedTextToClipboard(ZLDialogManager::CLIPBOARD_SELECTION);
|
//myView.copySelectedTextToClipboard(ZLDialogManager::CLIPBOARD_SELECTION);
|
||||||
myTextIsUpToDate = false;
|
//myTextIsUpToDate = false;
|
||||||
myText.delete(0, myText.length());
|
myText.delete(0, myText.length());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -179,9 +177,8 @@ final class ZLTextSelectionModel {
|
||||||
myIsEmpty = true;
|
myIsEmpty = true;
|
||||||
myIsActive = false;
|
myIsActive = false;
|
||||||
myDoUpdate = false;
|
myDoUpdate = false;
|
||||||
myCursors.clear();
|
|
||||||
myText.delete(0, myText.length());
|
myText.delete(0, myText.length());
|
||||||
myTextIsUpToDate = true;
|
//myTextIsUpToDate = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Range getRange() {
|
Range getRange() {
|
||||||
|
|
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