mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-08-04 03:06:41 -04:00
Bug fix for #320 triggered when the library contained 1 item.
A sample library_zim.xml is available at
https://github.com/kiwix/testfiles/blob/master/libraryfiles/one_item_in_library/library_zim.xml
The bug seems to have been introduced inadvertently in
b9930252e1
which returned a null to `getView(...)`
I've left a key log statement as this was one clue (after checking
various other areas of the codebase) that indicated there might be a
problem related to the number of entries rather than the attributes of
the item. I aim to revise the format of the log message as part of a
wider update on logging.
This commit is contained in:
parent
7be9f61b83
commit
c10d836370
@ -24,6 +24,7 @@ import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.os.AsyncTask;
|
||||
import android.util.Base64;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@ -118,7 +119,7 @@ public class LibraryAdapter extends BaseAdapter {
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
ViewHolder holder;
|
||||
if (position + 1 >= listItems.size()) {
|
||||
if (position >= listItems.size()) {
|
||||
return convertView;
|
||||
}
|
||||
ListItem item = listItems.get(position);
|
||||
|
@ -20,6 +20,7 @@ import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.widget.SwipeRefreshLayout;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@ -156,6 +157,7 @@ public class LibraryFragment extends Fragment
|
||||
|
||||
@Override
|
||||
public void showBooks(LinkedList<Book> books) {
|
||||
Log.i("kiwix-showBooks", "Contains:" + books.size());
|
||||
libraryAdapter.setAllBooks(books);
|
||||
if (faActivity.searchView != null) {
|
||||
libraryAdapter.getFilter().filter(
|
||||
|
Loading…
x
Reference in New Issue
Block a user