Various again

master
Evan Leybourn 2010-11-04 17:09:39 +11:00
parent 448858bad8
commit b876c6df82
11 changed files with 202 additions and 121 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.eleybourn.bookcatalogue"
android:versionName="3.0" android:installLocation="preferExternal" android:versionCode="35">
android:versionName="3.0.1" android:versionCode="36">
<application android:label="@string/app_name" android:icon="@drawable/logo_bc">
<activity android:name=".BookCatalogue"
android:label="@string/app_name">

7
README
View File

@ -41,6 +41,13 @@ Features include;
case. e.g. "The murder on the links" becomes "The Murder on the Links"
* Using ISBN or Barcode scanning will also download a thumbnail (if available)
New in v3.0.1
* Export bug fixed
* Further enhancements to the new ISBN screen
* Filtering by bookshelf on title view is now fixed
* There is now an <Empty Series> when sorting by Series (thanks Vinikia)
* App will now search all fields (Thanks Michael)
New in v3.0
* Added app2sd support (2.2 users only)
* You can now assign books to multiple bookshelves (requested by many people)

View File

@ -10,4 +10,4 @@
# Indicates whether an apk should be generated for each density.
split.density=false
# Project target.
target=android-8
target=android-7

View File

@ -9,8 +9,8 @@
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView android:id="@+id/isbn"
android:layout_width="wrap_content"
<EditText android:id="@+id/isbn"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="@string/isbn"
@ -27,21 +27,21 @@
<Button android:id="@+id/isbn_1"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="1"
android:width="50sp"
android:layout_width="50sp"
android:layout_height="wrap_content" />
android:width="75sp"
android:layout_width="75sp"
android:layout_height="75sp" />
<Button android:id="@+id/isbn_2"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="2"
android:width="50sp"
android:layout_width="50sp"
android:layout_height="wrap_content" />
android:width="75sp"
android:layout_width="75sp"
android:layout_height="75sp" />
<Button android:id="@+id/isbn_3"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="3"
android:width="50sp"
android:layout_width="50sp"
android:layout_height="wrap_content" />
android:width="75sp"
android:layout_width="75sp"
android:layout_height="75sp" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
@ -51,21 +51,21 @@
<Button android:id="@+id/isbn_4"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="4"
android:width="50sp"
android:layout_width="50sp"
android:layout_height="wrap_content" />
android:width="75sp"
android:layout_width="75sp"
android:layout_height="75sp" />
<Button android:id="@+id/isbn_5"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="5"
android:width="50sp"
android:layout_width="50sp"
android:layout_height="wrap_content" />
android:width="75sp"
android:layout_width="75sp"
android:layout_height="75sp" />
<Button android:id="@+id/isbn_6"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="6"
android:width="50sp"
android:layout_width="50sp"
android:layout_height="wrap_content" />
android:width="75sp"
android:layout_width="75sp"
android:layout_height="75sp" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
@ -75,21 +75,21 @@
<Button android:id="@+id/isbn_7"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="7"
android:width="50sp"
android:layout_width="50sp"
android:layout_height="wrap_content" />
android:width="75sp"
android:layout_width="75sp"
android:layout_height="75sp" />
<Button android:id="@+id/isbn_8"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="8"
android:width="50sp"
android:layout_width="50sp"
android:layout_height="50sp" />
android:width="75sp"
android:layout_width="75sp"
android:layout_height="75sp" />
<Button android:id="@+id/isbn_9"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="9"
android:width="50sp"
android:layout_width="50sp"
android:layout_height="50sp" />
android:width="75sp"
android:layout_width="75sp"
android:layout_height="75sp" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
@ -99,27 +99,27 @@
<Button android:id="@+id/isbn_X"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="X"
android:width="50sp"
android:layout_width="50sp"
android:layout_height="50sp" />
android:width="75sp"
android:layout_width="75sp"
android:layout_height="75sp" />
<Button android:id="@+id/isbn_0"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="0"
android:width="50sp"
android:layout_width="50sp"
android:layout_height="50sp" />
android:width="75sp"
android:layout_width="75sp"
android:layout_height="75sp" />
<ImageButton android:id="@+id/isbn_del"
android:textAppearance="?android:attr/textAppearanceLarge"
android:src="@+drawable/sym_keyboard_feedback_delete"
android:width="50sp"
android:layout_width="50sp"
android:layout_height="50sp" />
android:width="75sp"
android:layout_width="75sp"
android:layout_height="75sp" />
</LinearLayout>
<Button android:id="@+id/search"
android:text="@string/search"
android:layout_width="fill_parent"
android:width="150sp"
android:width="175sp"
android:layout_height="wrap_content" />
<TextView android:id="@+id/isbn_search_status"

View File

@ -2,37 +2,74 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="40dp">
<ImageView android:id="@+id/row_image_view"
android:layout_width="50dp"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:visibility="gone"
/>
<TextView android:id="@+id/row_img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
/>
<TextView android:id="@+id/row_series_num"
android:layout_height="40dp"
>
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:gravity="left"
android:layout_weight="0"
>
<ImageView android:id="@+id/row_image_view"
android:layout_width="50dp"
android:layout_height="wrap_content"
android:visibility="gone"
/>
<TextView android:id="@+id/row_img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:gravity="left"
android:paddingTop="10dp"
android:paddingBottom="10dp"
/>
<TextView android:id="@+id/row_title"
android:paddingBottom="10dp"
android:layout_weight="1"
>
<TextView android:id="@+id/row_series_num"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:lines="1"
/>
<TextView android:id="@+id/row_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:lines="1"
/>
<TextView android:id="@+id/row_author"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:lines="1"
/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
/>
<TextView android:id="@+id/row_author"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
/>
android:paddingRight="10dp"
android:gravity="right"
android:layout_weight="0"
>
<ImageView android:id="@+id/row_read_image_view"
android:layout_width="30dp"
android:layout_height="wrap_content"
android:src="@drawable/btn_check_buttonless_off"
android:visibility="gone"
/>
<TextView android:id="@+id/row_read"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
/>
</LinearLayout>
</LinearLayout>

View File

@ -44,7 +44,6 @@ import android.os.Environment;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;
@ -106,7 +105,6 @@ public class AdministrationFunctions extends Activity {
mDbHelper.open();
setContentView(R.layout.administration_functions);
Bundle extras = getIntent().getExtras();
Log.e("BC", "Admin");
try {
if (extras.getString(DOAUTO).equals("export")) {
finish_after = true;
@ -118,7 +116,6 @@ public class AdministrationFunctions extends Activity {
} catch (NullPointerException e) {
//do nothing
}
Log.e("BC", "Setup");
setupAdmin();
} catch (Exception e) {
//Log.e("Book Catalogue", "Unknown Exception - BC onCreate - " + e.getMessage() );
@ -135,13 +132,10 @@ public class AdministrationFunctions extends Activity {
*/
public void setupAdmin() {
/* Bookshelf Link */
Log.e("BC", "Setup");
TextView bookshelf = (TextView) findViewById(R.id.bookshelf_label);
Log.e("BC", bookshelf.toString());
bookshelf.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Log.e("BC", "Click");
manageBookselves();
return;
}
@ -378,7 +372,7 @@ public class AdministrationFunctions extends Activity {
'"' + CatalogueDBAdapter.KEY_PUBLISHER + "\"," + //6
'"' + CatalogueDBAdapter.KEY_DATE_PUBLISHED + "\"," + //7
'"' + CatalogueDBAdapter.KEY_RATING + "\"," + //8
'"' + "bookshelf_id,\"" + //9
'"' + "bookshelf_id\"," + //9
'"' + CatalogueDBAdapter.KEY_BOOKSHELF + "\"," + //10
'"' + CatalogueDBAdapter.KEY_READ + "\"," + //11
'"' + CatalogueDBAdapter.KEY_SERIES + "\"," + //12
@ -608,11 +602,9 @@ public class AdministrationFunctions extends Activity {
int num = 0;
/* Iterate through each imported row */
while (row < export.size()) {
Log.e("BC", "Row: " + row);
num++;
String[] imported = returnRow(export.get(row));
row++;
Log.e("BC", "A: " + row);
/* Setup aliases for each cell*/
Long id = null;
@ -621,7 +613,6 @@ public class AdministrationFunctions extends Activity {
} catch(Exception e) {
id = Long.parseLong("0");
}
Log.e("BC", "1: " + row);
String family = "";
try {
@ -630,7 +621,6 @@ public class AdministrationFunctions extends Activity {
// family is a compulsory field
continue;
}
Log.e("BC", "2: " + row);
String given = "";
try {
given = imported[2];
@ -639,7 +629,6 @@ public class AdministrationFunctions extends Activity {
}
//String author_id = imported[3];
Log.e("BC", "3: " + row);
String title = "";
title = imported[4];
try {
@ -648,7 +637,6 @@ public class AdministrationFunctions extends Activity {
//title is a compulsory field
continue;
}
Log.e("BC", "4: " + row);
String isbn = "";
try {
@ -656,7 +644,6 @@ public class AdministrationFunctions extends Activity {
} catch (Exception e) {
isbn = "";
}
Log.e("BC", "5: " + row);
String publisher = "";
try {
@ -664,7 +651,6 @@ public class AdministrationFunctions extends Activity {
} catch (Exception e) {
publisher = "";
}
Log.e("BC", "B: " + row);
String date_published = "";
try {
@ -749,7 +735,6 @@ public class AdministrationFunctions extends Activity {
} catch (Exception e) {
location = "";
}
Log.e("BC", "C: " + row);
String read_start = "";
try {
@ -803,7 +788,6 @@ public class AdministrationFunctions extends Activity {
anthology_titles = "";
}
Log.e("BC", "D: " + row);
String author = family + ", " + given;
try {
if (id == 0) {
@ -834,7 +818,7 @@ public class AdministrationFunctions extends Activity {
}
}
} catch (Exception e) {
Log.e("BC", "Import Book (Single) Error");
//Log.e("BC", "Import Book (Single) Error");
// do nothing
}
@ -851,7 +835,6 @@ public class AdministrationFunctions extends Activity {
}
}
}
Log.e("BC", num + " " + title);
sendMessage(num, title);
}
sendMessage(0, "Complete");

View File

@ -31,9 +31,6 @@ import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import android.app.backup.BackupAgent;
import android.app.backup.BackupDataInput;
import android.app.backup.BackupDataOutput;
import android.database.Cursor;
import android.os.ParcelFileDescriptor;
@ -41,21 +38,22 @@ import android.os.ParcelFileDescriptor;
* A book catalogue application that integrates with Google Books.
*/
/* THIS DOES NOT WORK YET */
public class BookBackupAgent extends BackupAgent {
public class BookBackupAgent { //TODO extends BackupAgent
static final int AGENT_VERSION = 1;
static final String APP_DATA_KEY = "alldata";
public int mCount = 0;
public CatalogueDBAdapter mDbHelper;
/** For convenience, we set up the File object for the app's data on creation */
@Override
//TODO @Override
public void onCreate() {
mDbHelper = new CatalogueDBAdapter(this);
mDbHelper = null; //TODO new CatalogueDBAdapter(this);
}
/* (non-Javadoc)
* @see android.app.backup.BackupAgent#onBackup(android.os.ParcelFileDescriptor, android.app.backup.BackupDataOutput, android.os.ParcelFileDescriptor)
*/
/*
@Override
public void onBackup(ParcelFileDescriptor oldState, BackupDataOutput data, ParcelFileDescriptor newState) throws IOException {
try {
@ -191,7 +189,7 @@ public class BookBackupAgent extends BackupAgent {
while (books.moveToNext());
}
/* write to the SDCard */
// write to the SDCard
try {
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(AdministrationFunctions.filePath), AdministrationFunctions.UTF8), AdministrationFunctions.BUFFER_SIZE);
out.write(export);
@ -220,11 +218,13 @@ public class BookBackupAgent extends BackupAgent {
//I can't test this, so I don't know if it will work
}
}
*/
/* (non-Javadoc)
* @see android.app.backup.BackupAgent#onRestore(android.app.backup.BackupDataInput, int, android.os.ParcelFileDescriptor)
*/
@Override
//TODO @Override
/* TODO
public void onRestore(BackupDataInput data, int appVersionCode, ParcelFileDescriptor newState) throws IOException {
try {
data.readNextHeader();
@ -248,7 +248,7 @@ public class BookBackupAgent extends BackupAgent {
}
//TODO: As before
/* Iterate through each imported row */
// Iterate through each imported row
int row = 1;
while (row < export.size()) {
String[] imported = export.get(row).split("\t");
@ -266,7 +266,7 @@ public class BookBackupAgent extends BackupAgent {
// This import line is too short
row++;
/* Setup aliases for each cell*/
// Setup aliases for each cell
Long id = null;
try {
id = Long.parseLong(imported[0]);
@ -499,5 +499,6 @@ public class BookBackupAgent extends BackupAgent {
// I can't test this so I don't know if it will work
}
}
*/
}

View File

@ -39,7 +39,6 @@ import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.ContextMenu;
import android.view.KeyEvent;
import android.view.Menu;
@ -124,7 +123,6 @@ public class BookCatalogue extends ExpandableListActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
bookshelf = getString(R.string.all_books);
Log.e("BC", "VERSION " + CatalogueDBAdapter.DATABASE_VERSION + " ");
try {
super.onCreate(savedInstanceState);
// Extract the sort type from the bundle. getInt will return 0 if there is no attribute
@ -138,7 +136,7 @@ public class BookCatalogue extends ExpandableListActivity {
addToCurrentGroup(pos, true);
}
} catch (Exception e) {
Log.e("Book Catalogue", "Unknown Exception - BC Prefs - " + e.getMessage() );
//Log.e("Book Catalogue", "Unknown Exception - BC Prefs - " + e.getMessage() );
}
// This sets the search capability to local (application) search
setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL);
@ -152,7 +150,7 @@ public class BookCatalogue extends ExpandableListActivity {
}
registerForContextMenu(getExpandableListView());
} catch (Exception e) {
Log.e("Book Catalogue", "Unknown Exception - BC onCreate - " + e.getMessage() );
//Log.e("Book Catalogue", "Unknown Exception - BC onCreate - " + e.getMessage() );
}
}
@ -444,7 +442,7 @@ public class BookCatalogue extends ExpandableListActivity {
this.setTitle(R.string.search_title);
} else {
// Return all books for the given bookshelf
BooksCursor = mDbHelper.fetchAllSeries(bookshelf);
BooksCursor = mDbHelper.fetchAllSeries(bookshelf, true);
numAuthors = BooksCursor.getCount();
this.setTitle(R.string.app_name);
}
@ -453,11 +451,11 @@ public class BookCatalogue extends ExpandableListActivity {
// Create an array to specify the fields we want to display in the list
String[] from = new String[]{CatalogueDBAdapter.KEY_ROWID};
String[] exp_from = new String[]{CatalogueDBAdapter.KEY_ROWID, CatalogueDBAdapter.KEY_SERIES_NUM, CatalogueDBAdapter.KEY_TITLE, CatalogueDBAdapter.KEY_AUTHOR_FORMATTED};
String[] exp_from = new String[]{CatalogueDBAdapter.KEY_ROWID, CatalogueDBAdapter.KEY_SERIES_NUM, CatalogueDBAdapter.KEY_TITLE, CatalogueDBAdapter.KEY_AUTHOR_FORMATTED, CatalogueDBAdapter.KEY_READ};
// and an array of the fields we want to bind those fields to (in this case just text1)
int[] to = new int[]{R.id.row_family};
int[] exp_to = new int[]{R.id.row_img, R.id.row_series_num, R.id.row_title, R.id.row_author};
int[] exp_to = new int[]{R.id.row_img, R.id.row_series_num, R.id.row_title, R.id.row_author, R.id.row_read};
// Instantiate the List Adapter
ExpandableListAdapter books = new SeriesBookListAdapter(BooksCursor, this, layout, layout_child, from, to, exp_from, exp_to);
@ -545,6 +543,21 @@ public class BookCatalogue extends ExpandableListActivity {
}
text = "";
return;
} else if (v.getId() == R.id.row_read) {
boolean field_visibility = mPrefs.getBoolean(FieldVisibility.prefix + "read", true);
ImageView newv = (ImageView) ((ViewGroup) v.getParent()).findViewById(R.id.row_read_image_view);
if (field_visibility == false) {
newv.setVisibility(GONE);
} else {
if (text.equals("1")) {
newv.setImageResource(R.drawable.btn_check_buttonless_on);
} else {
newv.setImageResource(R.drawable.btn_check_buttonless_off);
}
newv.setVisibility(VISIBLE);
}
text = "";
return;
}
v.setText(text);
}
@ -1119,7 +1132,7 @@ public class BookCatalogue extends ExpandableListActivity {
view.setSelectedGroup(currentGroup.get(currentGroup.size()-1));
} catch (Exception e) {
Log.e("Book Catalogue", "Unknown Exception - BC gotoCurrentGroup - " + e.getMessage() );
//Log.e("Book Catalogue", "Unknown Exception - BC gotoCurrentGroup - " + e.getMessage() );
}
return;
}

View File

@ -43,11 +43,10 @@ import android.graphics.Matrix;
import android.net.Uri;
import android.os.Bundle;
import android.provider.MediaStore;
import android.util.Log;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.MenuItem;
import android.view.View;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.View.OnClickListener;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
@ -254,7 +253,6 @@ public class BookEditFields extends Activity {
mBookshelfButton = (Button) findViewById(R.id.bookshelf);
mBookshelfText = (TextView) findViewById(R.id.bookshelf_text);
Log.e("BC", "FOO");
mBookshelfButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Cursor bookshelves_for_book = null;
@ -282,7 +280,6 @@ public class BookEditFields extends Activity {
boolean checked = false;
int db_book = bookshelves_for_book.getInt(bookshelves_for_book.getColumnIndex(CatalogueDBAdapter.KEY_BOOK));
String db_bookshelf = bookshelves_for_book.getString(bookshelves_for_book.getColumnIndex(CatalogueDBAdapter.KEY_BOOKSHELF));
Log.e("BC", "Bookshelf " + db_bookshelf + " " + db_book);
if (db_book == 1 || mBookshelfText.getText().toString().indexOf(db_bookshelf + BOOKSHELF_SEPERATOR) > -1) {
checked = true;
}
@ -392,7 +389,7 @@ public class BookEditFields extends Activity {
}
});
} catch (SQLException e) {
Log.e("Book Catalogue", "Unknown error " + e.toString());
//Log.e("Book Catalogue", "Unknown error " + e.toString());
}
}
@ -456,7 +453,7 @@ public class BookEditFields extends Activity {
try {
f = new FileOutputStream(filename);
} catch (FileNotFoundException e) {
Log.e("Book Catalogue", "Thumbnail cannot be written");
//Log.e("Book Catalogue", "Thumbnail cannot be written");
return;
}
x.compress(Bitmap.CompressFormat.PNG, 100, f);
@ -811,7 +808,7 @@ public class BookEditFields extends Activity {
try {
f = new FileOutputStream(filename);
} catch (FileNotFoundException e) {
Log.e("Book Catalogue", "Thumbnail cannot be written");
//Log.e("Book Catalogue", "Thumbnail cannot be written");
return;
}

View File

@ -37,6 +37,7 @@ import android.database.Cursor;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.TextView;
import android.widget.Toast;
@ -50,7 +51,7 @@ import android.widget.Toast;
public class BookISBNSearch extends Activity {
private static final int CREATE_BOOK = 0;
private TextView mIsbnText;
private EditText mIsbnText;
private TextView mIsbnStatus;
private Button mConfirmButton;
private CatalogueDBAdapter mDbHelper;
@ -73,7 +74,7 @@ public class BookISBNSearch extends Activity {
mDbHelper.open();
setContentView(R.layout.isbn_search);
mIsbnText = (TextView) findViewById(R.id.isbn);
mIsbnText = (EditText) findViewById(R.id.isbn);
mIsbnStatus = (TextView) findViewById(R.id.isbn_search_status);
mConfirmButton = (Button) findViewById(R.id.search);

View File

@ -88,6 +88,8 @@ public class CatalogueDBAdapter {
public static final int ANTHOLOGY_SAME_AUTHOR = 1;
public static final int ANTHOLOGY_MULTIPLE_AUTHORS = 2;
public static final String META_EMPTY_SERIES = "<Empty Series>";
/* Database creation sql statement */
private static final String DATABASE_CREATE_AUTHORS =
"create table " + DB_TB_AUTHORS +
@ -193,7 +195,7 @@ public class CatalogueDBAdapter {
private final Context mCtx;
public static final int DATABASE_VERSION = 42;
public static final int DATABASE_VERSION = 43;
/**
* This is a specific version of the SQLiteOpenHelper class. It handles onCreate and onUpgrade events
@ -513,6 +515,15 @@ public class CatalogueDBAdapter {
//do nothing
}
}
if (curVersion == 42) {
//do nothing
curVersion++;
message += "* Export bug fixed\n\n";
message += "* Further enhancements to the new ISBN screen\n\n";
message += "* Filtering by bookshelf on title view is now fixed\n\n";
message += "* There is now an <Empty Series> when sorting by Series (thanks Vinikia)\n\n";
message += "* App will now search all fields (Thanks Michael)\n\n";
}
}
}
@ -830,7 +841,7 @@ public class CatalogueDBAdapter {
* @return Cursor over all books
*/
public Cursor fetchAllBooks(String order, String bookshelf) {
return fetchAllBooks(order, "All Books", "");
return fetchAllBooks(order, bookshelf, "");
}
/**
@ -921,7 +932,13 @@ public class CatalogueDBAdapter {
* @return Cursor over all books
*/
public Cursor fetchAllBooksBySeries(String series, String bookshelf) {
String where = " AND b." + KEY_SERIES + "='" + encodeString(series) + "'";
String where = " AND ";
if (series.equals(META_EMPTY_SERIES)) {
where += "(b." + KEY_SERIES + "='' OR b." + KEY_SERIES + " IS NULL)";
} else {
series = encodeString(series);
where += "b." + KEY_SERIES + "='" + series + "'";
}
String order = "substr('0000000000' || b." + KEY_SERIES_NUM + ", -10, 10), lower(b." + KEY_TITLE + ") ASC";
return fetchAllBooks(order, bookshelf, where);
}
@ -967,7 +984,7 @@ public class CatalogueDBAdapter {
* @return Cursor over all bookshelves
*/
public Cursor fetchAllBookshelvesByBook(long rowId) {
String sql = "SELECT DISTINCT bs." + KEY_ROWID + ", bs." + KEY_BOOKSHELF + " as " + KEY_BOOKSHELF +
String sql = "SELECT DISTINCT bs." + KEY_ROWID + " as " + KEY_ROWID + ", bs." + KEY_BOOKSHELF + " as " + KEY_BOOKSHELF +
" FROM " + DB_TB_BOOKSHELF + " bs, " + DB_TB_BOOK_BOOKSHELF_WEAK + " w " +
" WHERE w." + KEY_BOOKSHELF + "=bs." + KEY_ROWID + " AND w." + KEY_BOOK + "=" + rowId + " " +
" ORDER BY bs." + KEY_BOOKSHELF + "";
@ -1024,6 +1041,16 @@ public class CatalogueDBAdapter {
* @return Cursor over all series
*/
public Cursor fetchAllSeries(String bookshelf) {
return fetchAllSeries(bookshelf, false);
}
/**
* This will return a list of all series within the given bookshelf
*
* @param bookshelf The bookshelf to search within. Can be the string "All Books"
* @return Cursor over all series
*/
public Cursor fetchAllSeries(String bookshelf, boolean include_blank) {
String where = "";
if (bookshelf.equals("All Books")) {
// do nothing
@ -1033,6 +1060,7 @@ public class CatalogueDBAdapter {
String sql = "SELECT DISTINCT b." + KEY_SERIES + " as " + KEY_ROWID +
" FROM " + BOOKSHELF_TABLES +
" WHERE " + BOOKSHELF_JOIN + " AND b." + KEY_SERIES + "!= '' " + where +
" UNION SELECT \"" + META_EMPTY_SERIES + "\" as " + KEY_ROWID +
" ORDER BY b." + KEY_SERIES + "";
return mDb.rawQuery(sql, new String[]{});
}
@ -1272,7 +1300,13 @@ public class CatalogueDBAdapter {
" FROM " + DB_TB_AUTHORS + " a" + " " +
"WHERE (a." + KEY_FAMILY_NAME + " LIKE '%" + query + "%' OR " +
"a." + KEY_GIVEN_NAMES + " LIKE '%" + query + "%' OR " +
"a." + KEY_ROWID + " IN (SELECT " + KEY_AUTHOR + " FROM " + DB_TB_BOOKS + " b WHERE (b." + KEY_TITLE + " LIKE '%" + query + "%' OR b." + KEY_SERIES + " LIKE '%" + query + "%')) )" +
"a." + KEY_ROWID + " IN (SELECT " + KEY_AUTHOR + " FROM " + DB_TB_BOOKS + " b " +
"WHERE (b." + KEY_TITLE + " LIKE '%" + query + "%' OR " +
" b." + KEY_ISBN + " LIKE '%" + query + "%' OR " +
" b." + KEY_PUBLISHER + " LIKE '%" + query + "%' OR " +
" b." + KEY_SERIES + " LIKE '%" + query + "%' OR " +
" b." + KEY_NOTES + " LIKE '%" + query + "%' OR " +
" b." + KEY_LOCATION + " LIKE '%" + query + "%')) )" +
where +
"ORDER BY " + KEY_FAMILY_NAME + ", " + KEY_GIVEN_NAMES + "";
return mDb.rawQuery(sql, new String[]{});
@ -1295,7 +1329,7 @@ public class CatalogueDBAdapter {
} else {
where += " AND bs." + KEY_BOOKSHELF + "='" + encodeString(bookshelf) + "'";
}
String sql = "SELECT DISTINCT b." + KEY_ROWID + ", " +
String sql = "SELECT DISTINCT b." + KEY_ROWID + " AS " + KEY_ROWID + ", " +
AUTHOR_FIELDS + ", " +
BOOK_FIELDS +
" FROM " + BOOKSHELF_TABLES + ", " + DB_TB_AUTHORS + " a" +
@ -1304,7 +1338,11 @@ public class CatalogueDBAdapter {
"(a." + KEY_FAMILY_NAME + " LIKE '%" + query + "%' OR " +
" a." + KEY_GIVEN_NAMES + " LIKE '%" + query + "%' OR " +
" b." + KEY_TITLE + " LIKE '%" + query + "%' OR " +
"b." + KEY_SERIES + " LIKE '%" + query + "%')" +
" b." + KEY_ISBN + " LIKE '%" + query + "%' OR " +
" b." + KEY_PUBLISHER + " LIKE '%" + query + "%' OR " +
" b." + KEY_SERIES + " LIKE '%" + query + "%' OR " +
" b." + KEY_NOTES + " LIKE '%" + query + "%' OR " +
" b." + KEY_LOCATION + " LIKE '%" + query + "%')" +
where +
" ORDER BY " + order + "";
return mDb.rawQuery(sql, new String[]{});
@ -1333,7 +1371,11 @@ public class CatalogueDBAdapter {
" (a." + KEY_FAMILY_NAME + " LIKE '%" + query + "%' OR " +
" a." + KEY_GIVEN_NAMES + " LIKE '%" + query + "%' OR " +
" b." + KEY_TITLE + " LIKE '%" + query + "%' OR " +
"b." + KEY_SERIES + " LIKE '%" + query + "%')" +
" b." + KEY_ISBN + " LIKE '%" + query + "%' OR " +
" b." + KEY_PUBLISHER + " LIKE '%" + query + "%' OR " +
" b." + KEY_SERIES + " LIKE '%" + query + "%' OR " +
" b." + KEY_NOTES + " LIKE '%" + query + "%' OR " +
" b." + KEY_LOCATION + " LIKE '%" + query + "%')" +
" ORDER BY b." + KEY_SERIES + "";
return mDb.rawQuery(sql, new String[]{});
}