diff --git a/assets/resources/application/en.xml b/assets/resources/application/en.xml
index 8a48fcc2c..d49e2c6a5 100644
--- a/assets/resources/application/en.xml
+++ b/assets/resources/application/en.xml
@@ -42,10 +42,6 @@
-
-
-
-
diff --git a/src/org/geometerplus/android/fbreader/library/BaseActivity.java b/src/org/geometerplus/android/fbreader/library/BaseActivity.java
new file mode 100644
index 000000000..68290cddd
--- /dev/null
+++ b/src/org/geometerplus/android/fbreader/library/BaseActivity.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2010 Geometer Plus
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+package org.geometerplus.android.fbreader.library;
+
+import java.util.List;
+
+import android.app.*;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.graphics.Bitmap;
+import android.os.Bundle;
+import android.view.*;
+import android.widget.*;
+
+import org.geometerplus.zlibrary.core.resources.ZLResource;
+import org.geometerplus.zlibrary.core.image.ZLImage;
+import org.geometerplus.zlibrary.core.image.ZLLoadableImage;
+import org.geometerplus.zlibrary.core.options.ZLStringOption;
+
+import org.geometerplus.zlibrary.ui.android.image.ZLAndroidImageData;
+import org.geometerplus.zlibrary.ui.android.image.ZLAndroidImageManager;
+import org.geometerplus.zlibrary.ui.android.image.ZLAndroidImageLoader;
+
+import org.geometerplus.fbreader.tree.FBTree;
+import org.geometerplus.fbreader.library.*;
+import org.geometerplus.android.fbreader.FBReader;
+
+import org.geometerplus.zlibrary.ui.android.R;
+
+import org.geometerplus.android.util.UIUtil;
+import org.geometerplus.android.fbreader.tree.ZLAndroidTree;
+
+abstract class BaseActivity extends ListActivity {
+ public static final String SELECTED_BOOK_PATH_KEY = "SelectedBookPath";
+ /*private*/ static final int OPEN_BOOK_ITEM_ID = 0;
+ /*private*/ static final int ADD_TO_FAVORITES_ITEM_ID = 1;
+ /*private*/ static final int REMOVE_FROM_FAVORITES_ITEM_ID = 2;
+ /*private*/ static final int DELETE_BOOK_ITEM_ID = 3;
+
+ static Library LibraryInstance;
+
+ /*private*/ String mySelectedBookPath;
+
+ @Override
+ public void onCreate(Bundle icicle) {
+ super.onCreate(icicle);
+ Thread.setDefaultUncaughtExceptionHandler(new org.geometerplus.zlibrary.ui.android.library.UncaughtExceptionHandler(this));
+ mySelectedBookPath = getIntent().getStringExtra(SELECTED_BOOK_PATH_KEY);
+ }
+
+ protected void openBook(Book book) {
+ openBook(book.File.getPath());
+ }
+
+ protected void openBook(String path){
+ startActivity(
+ new Intent(getApplicationContext(), FBReader.class)
+ .setAction(Intent.ACTION_VIEW)
+ .putExtra(FBReader.BOOK_PATH_KEY, path)
+ .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK)
+ );
+ }
+}
diff --git a/src/org/geometerplus/android/fbreader/library/FManagerAdapter.java b/src/org/geometerplus/android/fbreader/library/FManagerAdapter.java
index 52c552c8c..76a77176c 100644
--- a/src/org/geometerplus/android/fbreader/library/FManagerAdapter.java
+++ b/src/org/geometerplus/android/fbreader/library/FManagerAdapter.java
@@ -90,18 +90,13 @@ public class FManagerAdapter extends BaseAdapter implements View.OnCreateContext
menu.add(0, FileManager.OPEN_BOOK_ITEM_ID, 0, resource.getResource("openBook").getValue());
menu.add(0, FileManager.DELETE_BOOK_ITEM_ID, 0, resource.getResource("deleteBook").getValue());
- try{
- if (FileManager.LibraryInstance.isBookInFavorites(book)) {
- menu.add(0, FileManager.REMOVE_FROM_FAVORITES_ITEM_ID, 0, resource.getResource("removeFromFavorites").getValue());
- } else {
- menu.add(0, FileManager.ADD_TO_FAVORITES_ITEM_ID, 0, resource.getResource("addToFavorites").getValue());
- }
- if ((FileManager.LibraryInstance.getRemoveBookMode(book) & Library.REMOVE_FROM_DISK) != 0) {
- menu.add(0, FileManager.DELETE_BOOK_ITEM_ID, 0, resource.getResource("deleteBook").getValue());
- }
+ if (FileManager.LibraryInstance.isBookInFavorites(book)) {
+ menu.add(0, FileManager.REMOVE_FROM_FAVORITES_ITEM_ID, 0, resource.getResource("removeFromFavorites").getValue());
+ } else {
+ menu.add(0, FileManager.ADD_TO_FAVORITES_ITEM_ID, 0, resource.getResource("addToFavorites").getValue());
}
- catch (Exception e) {
- Log.v(FileManager.LOG, "FileManager.LibraryInstance.isBookInFavorites(book) = exception");
+ if ((FileManager.LibraryInstance.getRemoveBookMode(book) & Library.REMOVE_FROM_DISK) != 0) {
+ menu.add(0, FileManager.DELETE_BOOK_ITEM_ID, 0, resource.getResource("deleteBook").getValue());
}
}
}
@@ -159,7 +154,6 @@ public class FManagerAdapter extends BaseAdapter implements View.OnCreateContext
data = mgr.getImageData(cover);
}
if (data != null) {
- Log.v(FileManager.LOG, "data != null");
coverBitmap = data.getBitmap(2 * myCoverWidth, 2 * myCoverHeight);
}
}
diff --git a/src/org/geometerplus/android/fbreader/library/FileManager.java b/src/org/geometerplus/android/fbreader/library/FileManager.java
index 5ad4894b1..a49a89f70 100644
--- a/src/org/geometerplus/android/fbreader/library/FileManager.java
+++ b/src/org/geometerplus/android/fbreader/library/FileManager.java
@@ -39,15 +39,12 @@ import org.geometerplus.zlibrary.core.filesystem.ZLFile;
import org.geometerplus.zlibrary.core.resources.ZLResource;
import org.geometerplus.zlibrary.ui.android.R;
-public final class FileManager extends ListActivity {
+public final class FileManager extends BaseActivity {
public static String FILE_MANAGER_PATH = "FileManagerPath";
- public static String LOG = "FileManager";
- public static Library LibraryInstance;
private final ZLResource myResource = ZLResource.resource("fileManagerView");
@Override
public void onCreate(Bundle savedInstanceState) {
- Log.v(LOG, "onCreate()");
super.onCreate(savedInstanceState);
FManagerAdapter adapter = new FManagerAdapter(this);
@@ -76,11 +73,6 @@ public final class FileManager extends ListActivity {
});
}
- public static final int OPEN_BOOK_ITEM_ID = 0;
- public static final int ADD_TO_FAVORITES_ITEM_ID = 1;
- public static final int REMOVE_FROM_FAVORITES_ITEM_ID = 2;
- public static final int DELETE_BOOK_ITEM_ID = 3;
-
@Override
public boolean onContextItemSelected(MenuItem item) {
final int position = ((AdapterView.AdapterContextMenuInfo)item.getMenuInfo()).position;
@@ -132,12 +124,4 @@ public final class FileManager extends ListActivity {
resource.getResource("summary").getValue()
));
}
-
- private void openBook(String path){
- Intent i = new Intent(this, FBReader.class);
- i.setAction(Intent.ACTION_VIEW);
- i.putExtra(FBReader.BOOK_PATH_KEY, path);
- i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
- startActivity(i);
- }
}
diff --git a/src/org/geometerplus/android/fbreader/library/LibraryBaseActivity.java b/src/org/geometerplus/android/fbreader/library/LibraryBaseActivity.java
index 0224ff48a..c71e06e5b 100644
--- a/src/org/geometerplus/android/fbreader/library/LibraryBaseActivity.java
+++ b/src/org/geometerplus/android/fbreader/library/LibraryBaseActivity.java
@@ -47,8 +47,7 @@ import org.geometerplus.zlibrary.ui.android.R;
import org.geometerplus.android.util.UIUtil;
import org.geometerplus.android.fbreader.tree.ZLAndroidTree;
-abstract class LibraryBaseActivity extends ListActivity {
- public static final String SELECTED_BOOK_PATH_KEY = "SelectedBookPath";
+abstract class LibraryBaseActivity extends BaseActivity {
static final String TREE_PATH_KEY = "TreePath";
static final String PARAMETER_KEY = "Parameter";
@@ -58,13 +57,10 @@ abstract class LibraryBaseActivity extends ListActivity {
static final String PATH_BY_AUTHOR = "byAuthor";
static final String PATH_BY_TAG = "byTag";
- static Library LibraryInstance;
-
static final ZLStringOption BookSearchPatternOption =
new ZLStringOption("BookSearch", "Pattern", "");
protected final ZLResource myResource = ZLResource.resource("libraryView");
- private String mySelectedBookPath;
private static int CHILD_LIST_REQUEST = 0;
private static int RESULT_DONT_INVALIDATE_VIEWS = 0;
@@ -74,8 +70,6 @@ abstract class LibraryBaseActivity extends ListActivity {
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setResult(RESULT_DONT_INVALIDATE_VIEWS);
- Thread.setDefaultUncaughtExceptionHandler(new org.geometerplus.zlibrary.ui.android.library.UncaughtExceptionHandler(this));
- mySelectedBookPath = getIntent().getStringExtra(SELECTED_BOOK_PATH_KEY);
}
@Override
@@ -224,20 +218,6 @@ abstract class LibraryBaseActivity extends ListActivity {
}
}
- protected void openBook(Book book) {
- startActivity(
- new Intent(getApplicationContext(), FBReader.class)
- .setAction(Intent.ACTION_VIEW)
- .putExtra(FBReader.BOOK_PATH_KEY, book.File.getPath())
- .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK)
- );
- }
-
- private static final int OPEN_BOOK_ITEM_ID = 0;
- private static final int ADD_TO_FAVORITES_ITEM_ID = 1;
- private static final int REMOVE_FROM_FAVORITES_ITEM_ID = 2;
- private static final int DELETE_BOOK_ITEM_ID = 3;
-
@Override
public boolean onContextItemSelected(MenuItem item) {
final int position = ((AdapterView.AdapterContextMenuInfo)item.getMenuInfo()).position;
diff --git a/src/org/geometerplus/android/fbreader/library/SmartFilter.java b/src/org/geometerplus/android/fbreader/library/SmartFilter.java
index abead211e..da6f73b89 100644
--- a/src/org/geometerplus/android/fbreader/library/SmartFilter.java
+++ b/src/org/geometerplus/android/fbreader/library/SmartFilter.java
@@ -39,11 +39,11 @@ public class SmartFilter implements Runnable {
}
public void run() {
- try {
+ //try {
getItems();
- } catch (Exception e) {
- Log.e(FileManager.LOG, e.getMessage());
- }
+ //} catch (Exception e) {
+ // Log.e(FileManager.LOG, e.getMessage());
+ //}
}
private void getItems() {