Browse Source

fixed bug in search adapter

master
Anthony Restaino 9 years ago
parent
commit
71fcd174d7
  1. 2
      app/src/main/java/acr/browser/lightning/database/HistoryDatabase.java
  2. 2
      app/src/main/java/acr/browser/lightning/object/SearchAdapter.java

2
app/src/main/java/acr/browser/lightning/database/HistoryDatabase.java

@ -65,7 +65,7 @@ public class HistoryDatabase extends SQLiteOpenHelper {
onCreate(db); onCreate(db);
} }
private boolean isClosed() { public boolean isClosed() {
return mDatabase == null || !mDatabase.isOpen(); return mDatabase == null || !mDatabase.isOpen();
} }

2
app/src/main/java/acr/browser/lightning/object/SearchAdapter.java

@ -232,7 +232,7 @@ public class SearchAdapter extends BaseAdapter implements Filterable {
} }
} }
if (mDatabaseHandler == null) { if (mDatabaseHandler == null || mDatabaseHandler.isClosed()) {
mDatabaseHandler = HistoryDatabase.getInstance(mContext.getApplicationContext()); mDatabaseHandler = HistoryDatabase.getInstance(mContext.getApplicationContext());
} }
List<HistoryItem> historyList = mDatabaseHandler.findItemsContaining(constraint.toString()); List<HistoryItem> historyList = mDatabaseHandler.findItemsContaining(constraint.toString());

Loading…
Cancel
Save