diff --git a/TODO.library b/TODO.library
index 75b1e9cee..d980a921a 100644
--- a/TODO.library
+++ b/TODO.library
@@ -4,7 +4,7 @@
DONE Covers loading in background
DONE Wait messages
DONE Favorites
-* Show text if the favorites list is empty
+DONE Show text if the favorites list is empty
DONE Search
* Show wait message during search
* File view
diff --git a/assets/resources/application/cs.xml b/assets/resources/application/cs.xml
index c999cd46a..f365e5889 100644
--- a/assets/resources/application/cs.xml
+++ b/assets/resources/application/cs.xml
@@ -538,6 +538,7 @@
+
diff --git a/assets/resources/application/de.xml b/assets/resources/application/de.xml
index 8228dee94..0d627792f 100644
--- a/assets/resources/application/de.xml
+++ b/assets/resources/application/de.xml
@@ -539,6 +539,7 @@
+
diff --git a/assets/resources/application/en.xml b/assets/resources/application/en.xml
index d494be59a..d0d5297ba 100644
--- a/assets/resources/application/en.xml
+++ b/assets/resources/application/en.xml
@@ -540,6 +540,7 @@
+
diff --git a/assets/resources/application/fr.xml b/assets/resources/application/fr.xml
index 74b88fc23..fe787ad00 100644
--- a/assets/resources/application/fr.xml
+++ b/assets/resources/application/fr.xml
@@ -541,6 +541,7 @@
+
diff --git a/assets/resources/application/hu.xml b/assets/resources/application/hu.xml
index 6beab5ba9..8753a70c7 100644
--- a/assets/resources/application/hu.xml
+++ b/assets/resources/application/hu.xml
@@ -538,6 +538,7 @@
+
diff --git a/assets/resources/application/it.xml b/assets/resources/application/it.xml
index f0a6be9e6..e2e10104b 100644
--- a/assets/resources/application/it.xml
+++ b/assets/resources/application/it.xml
@@ -538,6 +538,7 @@
+
diff --git a/assets/resources/application/ru.xml b/assets/resources/application/ru.xml
index 583efb994..46394b03c 100644
--- a/assets/resources/application/ru.xml
+++ b/assets/resources/application/ru.xml
@@ -540,6 +540,7 @@
+
diff --git a/assets/resources/application/uk.xml b/assets/resources/application/uk.xml
index 3b160595f..318d8e021 100644
--- a/assets/resources/application/uk.xml
+++ b/assets/resources/application/uk.xml
@@ -538,6 +538,7 @@
+
diff --git a/assets/resources/application/vi.xml b/assets/resources/application/vi.xml
index 5623e8522..32ea8759e 100644
--- a/assets/resources/application/vi.xml
+++ b/assets/resources/application/vi.xml
@@ -538,6 +538,7 @@
+
diff --git a/assets/resources/application/zh.xml b/assets/resources/application/zh.xml
index 8eeb9df85..232a7bf72 100644
--- a/assets/resources/application/zh.xml
+++ b/assets/resources/application/zh.xml
@@ -538,6 +538,7 @@
+
diff --git a/src/org/geometerplus/android/fbreader/library/LibraryBaseActivity.java b/src/org/geometerplus/android/fbreader/library/LibraryBaseActivity.java
index d9afa5947..b7e02fedf 100644
--- a/src/org/geometerplus/android/fbreader/library/LibraryBaseActivity.java
+++ b/src/org/geometerplus/android/fbreader/library/LibraryBaseActivity.java
@@ -162,33 +162,44 @@ abstract class LibraryBaseActivity extends BaseActivity {
getListView().invalidateViews();
}
- protected class OpenTreeRunnable implements Runnable {
+ protected class StartTreeActivityRunnable implements Runnable {
private final String myTreePath;
private final String myParameter;
+ public StartTreeActivityRunnable(String treePath, String parameter) {
+ myTreePath = treePath;
+ myParameter = parameter;
+ }
+
+ public void run() {
+ startActivityForResult(
+ new Intent(LibraryBaseActivity.this, LibraryTreeActivity.class)
+ .putExtra(SELECTED_BOOK_PATH_KEY, mySelectedBookPath)
+ .putExtra(TREE_PATH_KEY, myTreePath)
+ .putExtra(PARAMETER_KEY, myParameter),
+ CHILD_LIST_REQUEST
+ );
+ }
+ }
+
+ protected class OpenTreeRunnable implements Runnable {
+ private final Runnable myPostRunnable;
+
public OpenTreeRunnable(String treePath) {
this(treePath, null);
}
public OpenTreeRunnable(String treePath, String parameter) {
- myTreePath = treePath;
- myParameter = parameter;
+ this(new StartTreeActivityRunnable(treePath, parameter));
+ }
+
+ public OpenTreeRunnable(Runnable postRunnable) {
+ myPostRunnable = postRunnable;
}
public void run() {
- final Runnable postRunnable = new Runnable() {
- public void run() {
- startActivityForResult(
- new Intent(LibraryBaseActivity.this, LibraryTreeActivity.class)
- .putExtra(SELECTED_BOOK_PATH_KEY, mySelectedBookPath)
- .putExtra(TREE_PATH_KEY, myTreePath)
- .putExtra(PARAMETER_KEY, myParameter),
- CHILD_LIST_REQUEST
- );
- }
- };
if (LibraryInstance.hasState(Library.STATE_FULLY_INITIALIZED)) {
- postRunnable.run();
+ myPostRunnable.run();
} else {
UIUtil.runWithMessage(LibraryBaseActivity.this, "loadingBookList",
new Runnable() {
@@ -196,7 +207,7 @@ abstract class LibraryBaseActivity extends BaseActivity {
LibraryInstance.waitForState(Library.STATE_FULLY_INITIALIZED);
}
},
- postRunnable);
+ myPostRunnable);
}
}
}
diff --git a/src/org/geometerplus/android/fbreader/library/LibraryTopLevelActivity.java b/src/org/geometerplus/android/fbreader/library/LibraryTopLevelActivity.java
index da5feb3ab..9d8ab8105 100644
--- a/src/org/geometerplus/android/fbreader/library/LibraryTopLevelActivity.java
+++ b/src/org/geometerplus/android/fbreader/library/LibraryTopLevelActivity.java
@@ -34,6 +34,7 @@ import org.geometerplus.zlibrary.ui.android.R;
import org.geometerplus.fbreader.library.Library;
import org.geometerplus.fbreader.tree.FBTree;
+import org.geometerplus.android.util.UIUtil;
import org.geometerplus.android.fbreader.SQLiteBooksDatabase;
import org.geometerplus.android.fbreader.tree.ZLAndroidTree;
@@ -58,7 +59,15 @@ public class LibraryTopLevelActivity extends LibraryBaseActivity {
myItems.add(new TopLevelTree(
myResource.getResource(PATH_FAVORITES),
R.drawable.ic_list_library_favorites,
- new OpenTreeRunnable(PATH_FAVORITES)
+ new OpenTreeRunnable(new StartTreeActivityRunnable(PATH_FAVORITES, null) {
+ public void run() {
+ if (LibraryInstance.favorites().hasChildren()) {
+ super.run();
+ } else {
+ UIUtil.showErrorMessage(LibraryTopLevelActivity.this, "noFavorites");
+ }
+ }
+ })
));
myItems.add(new TopLevelTree(
myResource.getResource(PATH_RECENT),